Order of plot criteria
Show older comments
Hi everyone, hope you are well.
I am currently experiencing an issue with the use of plotting whilst using a dynamic legend within a loop.
I have a series of 'if' statements with certain plotting criteria inside of each of them - this is because i would like a plot to be formed AND a legend addition to be made based ONLY if said condition is met, and to ignore this otherwise. My problem is basically that i am struggling with plot syntax haha. A sample of the code looks like this(note this is all inside a larger global for loop):
legend('-DynamicLegend')
hold all;
if norm(AZ_VT)~=norm(y)
plot(Az_IT_time,Az_IT,'r.','MarkerSize',3)
end
There are 3 other subsequent if statements like this.
My problem is that, now i have established the Dynamic Legend - I'd like to add this in if the condition is met, and ALSO display the number of the global iteration WITHIN the name of each legend entry.
So i've tried something like this for the plotting line above but keep getting errors:
plot(AZ_IT_time,AZ_IT,'r.','MarkerSize',3,DisplayName,'Item Number %d', num2str(Item))
where 'Item is simply a global loop counter.
I'm wondering if anyone that knows proper plotting syntax and the use of dynamic legends/including changing items in legends can help.
Thanks a lot.
C.
Accepted Answer
More Answers (0)
Categories
Find more on Legend 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!