How To Write Long Plot Handle

1 次查看(过去 30 天)
Matthew
Matthew 2017-10-11
评论: Matthew 2017-10-11
My code has the plot handle shown below that is used with 'plot3.' Seventeen different data sets (i.e., n=17) are being plotted together. The problem is that I need to use this syntax for plots of other sizes (e.g., n=6, n=12, n=<fill in the blank>, etc.) and don't want to write it out individually each time. Can this syntax be generated on-the-fly somehow? In other words, is there some way to run a FOR loop that will write this out, appending it for each loop until n has been reached, and then issue plot3 with it?
h1=plot3(coll{1}(:,1),coll{1}(:,2),coll{1}(:,3),coll{2}(:,1),coll{2}(:,2),coll{2}(:,3),...
coll{3}(:,1),coll{3}(:,2),coll{3}(:,3),coll{4}(:,1),coll{4}(:,2),coll{4}(:,3),...
coll{5}(:,1),coll{5}(:,2),coll{5}(:,3),coll{6}(:,1),coll{6}(:,2),coll{6}(:,3),...
coll{7}(:,1),coll{7}(:,2),coll{7}(:,3),coll{8}(:,1),coll{8}(:,2),coll{8}(:,3),...
coll{9}(:,1),coll{9}(:,2),coll{9}(:,3),coll{10}(:,1),coll{10}(:,2),coll{10}(:,3),...
coll{11}(:,1),coll{11}(:,2),coll{11}(:,3),coll{12}(:,1),coll{12}(:,2),coll{12}(:,3),...
coll{13}(:,1),coll{13}(:,2),coll{13}(:,3),coll{14}(:,1),coll{14}(:,2),coll{14}(:,3),...
coll{15}(:,1),coll{15}(:,2),coll{15}(:,3),coll{16}(:,1),coll{16}(:,2),coll{16}(:,3),...
coll{17}(:,1),coll{17}(:,2),coll{17}(:,3));
Thanks in advance,
M Ridzon
  2 个评论
Jan
Jan 2017-10-11
The usage of the term "handle" is not clear here.
Matthew
Matthew 2017-10-11
My apologies. The Help documentation often refers to the them as "handles" and that's where I gleaned it from. "Handle" here refers to "h1." It's merely a pointer (i.e., handle) for the plot. Later when setting other plot preferences, certain commands (e.g., 'set') references the handle to implement the commands. Hopefully that clears it up a bit.

请先登录,再进行评论。

采纳的回答

Jan
Jan 2017-10-11
编辑:Jan 2017-10-11
What about:
axes('NextPlot', 'add'); % or : hold('oll')
h = gobject(1, n);
for k = 1:n
h(k) = plot3(coll{k}(:,1), coll{k}(:,2), coll{k}(:,3));
end

更多回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by