The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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 ]

Posts: 118
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

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

I can plot my figures with different 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?

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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.