Question about convhull code

1 次查看(过去 30 天)
Ingo Rück
Ingo Rück 2017-7-19
编辑: Jan 2017-7-19
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 个评论
Image Analyst
Image Analyst 2017-7-19
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
Jan 2017-7-19
编辑:Jan 2017-7-19
@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.

请先登录,再进行评论。

采纳的回答

Jan
Jan 2017-7-19
编辑:Jan 2017-7-19
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 个)

类别

Help CenterFile Exchange 中查找有关 Bar Plots 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by