More easy that it seems.
You need to specify "Euclidean" distance :-)
Good problem, not too hard but required thinking
Please add the next test :
p = [0,0;
ix_correct = [1 3];
The solutions of the form:
will fail, the last line will return an extra index [1,3,4] instead of just [1,3]
Convex Hull therom and the Graham's Scan method
hehe, just trying to see if they have any hidden tests for the code.
Since yesterday, I submit the solution ,and it always shows "
While evaluating the solution, the server encountered an error caused by temporary unavailability of MATLAB Service. Wait a few minutes for the MATLAB Service to return, and then rescore."
I don't know how to deal with it?
You should be able to submit solutions now. Sorry for the inconveniene.
no function squareform either... pffff
Cody utilizes vanilla MATLAB (no toolboxes).
Why is there "undefined function 'dist' for input arguments of type 'double'."? Works on my machine (and online matlab too)
I solved the problem by an tedious approach.
remove ' diff ',but adds size -_-
I am using matlab2010 but dist function is not available in it. Can you tell me how and where can I use this?
Without dist, but with str2num
I think it works w/ just x*[1;i] . No need to convert from a string.
i'm not sure this can always get the right answer,
so i need more debugging.
what is 'i'? This is strange but works.
@Claudia, "i" is the imaginary number sqrt(-1). Unless you overwrite it, it's always available to you in MATLAB without needing to declare it.
This solution works fine, but requires the stats toolbox to function!
I dont get whay sort(unique(ix)) will give you the location of the two points. it is wrong for these points (0.9631 0.5468),(0.5211 0.2316),(0.4889,0.6241),(0.6791 0.3955),(0.3670 0.9890),
sort(unique(ix)) will return [1 2 5].
I think this solution is not right
there may be something out of word,
if i put:
p =[1 0; 0 1;0 0; 1/sqrt(2) 1/sqrt(2) ]
your command would not right,
but 'unique' is very admirable.
This is the smallest solution not to use "dist," which is not in core Matlab. Nicely done!
I don't know why Cody allows answers which depend on toolboxes. The whole point should be to write one's own "distance" function.
Hard to believe you let 'dist' in but not 'pdist'.
pdist is not allowed!
I find this a little bit unfair: dist is a neural network toolbox function. It is not available in MATLAB core, and the problem does not specify this toolbox is needed.
Shame on me...
Find the peak 3n+1 sequence value
Sum all integers from 1 to 2^n
Make an awesome ramp for a tiny motorcycle stuntman
sum of non-primes
Replace NaNs with the number that appears to its left in the row.
Find state names that start with the letter N
Prime factor digits
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office