Question about convhull code
1 view (last 30 days)
Show older comments
Hello everyone,
I'm using the function convhull to create a better looking hill chart. For that purpose I need to know how Matlab determines at which point the hull-curve should start. The documentation of convhull doesnt tell me anything and I'm too unexperienced to dig into the code of the function itself (that and I dont know when something is considered "reverse engineering", which might be illegal anyway).
2 Comments
Image Analyst
on 19 Jul 2017
Please include some screen shots. You can edit any program and see what it does, at least to some extent, for example
>> edit convhull.m
Perhaps you'd be interested in the boundary() or envelope() function instead - not sure until we see your data.
Jan
on 19 Jul 2017
Edited: Jan
on 19 Jul 2017
@Ingo: You have mentioned in your other thread, that you need the hull start with the smallest X and Y position. By the way: Whenever you post multiple thread about one problem, add a link to the thread in the other forum also. Otherwise such "cross-posting" can waste the time of the ones, who write an already given answer. Thanks.
Accepted Answer
Jan
on 19 Jul 2017
Edited: Jan
on 19 Jul 2017
Reading the M- and C-files is considered to be legal.
You can resort the output easily to be sure that it has the wanted order:
K = convhull(X,Y);
C = [X(K), Y(K)];
[~, Index] = sortrows(C); % Only the first entry matters
if Index(1) ~= 1 % Reordering required
K = circshift(K, -Index(1) + 1);
end
Now the first index in K is the position with the smallest X and Y values.
In the current Matlab version, K is ordered as you want it. But you cannot be sure if this is the general case, such that the above check is safer.
0 Comments
More Answers (0)
See Also
Categories
Find more on Bar Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!