Count curves on Matlab plot with specific name
Show older comments
Is there a way to count how many curves are on a specific Matlab Figure? I define the name of plot as
figure('Name','Simulation', 'NumberTitle', 'Off')
Since I have multiple plots generated at various times I am unable to use gcf. What I would like to do is something like
length(findall('type','line','Name','Simulation')
to find all curves associated with the plot (or plots) named Simulation.
3 Comments
Adam
on 18 Jan 2017
I'm not sure I understand what you mean. You say a 'specific Matlab Figure' which implies you already know your figure, yet it is the figure you are naming. Line objects do not have a 'Name', only a 'DisplayName' and this would generally be different for multiple lines on the same axes as it appears on the legend, though I guess it can be the same for multiple lines.
So what exactly are the criteria you are trying to search for?
Obviously, as with almost anything of this nature, it is usually far easier to keep track of these things on the raw data before/when you do the plotting rather than a post-plotting slow search of graphics objects.
Tyler Murray
on 18 Jan 2017
Tyler Murray
on 18 Jan 2017
Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects 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!