Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: how use from legend in a for loop?
Replies: 1   Last Post: May 24, 2013 8:12 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
ghasem

Posts: 95
Registered: 4/13/13
how use from legend in a for loop?
Posted: May 24, 2013 3:47 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi.
I want to use from legend in a for loop.
for example,my code is as following:

for f=[50e6 100e6 500e6 1e7]
... % a section from my code
plot(x,y) % y is updated in each for loop
hold all
end

I can plot my figures with different colors.in this step I don't have any problem.BUT I don't know how automatically call legend in/out of for loop.
I know that I can use from following method in this example:
legend('f=50e6' , 'f=100e6' , 'f=500e6' , 'f=1e7')
but when number of "f" is large in my code,I want to use from a automatic method.
how use from cell array for this purpose?
thanks




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.