How to group the green contour and the yellow contour?
2 次查看(过去 30 天)
显示 更早的评论
采纳的回答
jonas
2018-10-10
编辑:jonas
2018-10-10
Sure, the first output of the imcontour, just like any other contour plot, is a contour matrix . If you understand its structure, then it's quite easy to extract the individual levels. If you upload the image and code I might give it a try.
5 个评论
jonas
2018-10-12
Sure, here is an example. The contours are stored in out and their levels are stored in lvls.
%%Some data
t=1:100;
y=1:100;
z=peaks(100);
%%Get contours
C=contour(t,y,z,'levellist',[2 3]);
cnt=[0];nc=[];idc=[];
while (sum(nc)+cnt)<size(C,2)
cnt=cnt+1;
idc=[idc sum(nc)+cnt];
nc=[nc C(2,idc(end))];
end
%%Save levels and remove the corresponding cols
lvls=C(1,idc);
for j=1:length(idc)-1
out{j} = C(:,idc(j)+1:idc(j+1)-1);
end
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!