From: rams on
I want to display a value on the plot...my code is as follows..

plot(a,b);
hold on
plot(a,c);
axis([400 850 0 1]);
legend('first','second');
text(465,0.9,'Value=N(i)');

I want to display the value stored in N(i) on the plot.When i used this code it displaying just that string. Instead i want to display the value stored.Thanks in advance!
From: jrenfree on
On Jun 18, 11:48 am, rams <lrams...(a)gmail.com> wrote:
> I want to display a value on the plot...my code is as follows..
>
> plot(a,b);
> hold on
> plot(a,c);
> axis([400 850 0 1]);
> legend('first','second');
> text(465,0.9,'Value=N(i)');
>
> I want to display the value stored in N(i) on the plot.When i used this code it displaying just that string. Instead i want to display the value stored.Thanks in advance!

When specify N(i) in a string, it doesn't know that you're actually
trying to access a variable. Try something like:

text(465, 0.9, sprintf('Value=%d', N(i)))
From: Walter Roberson on
rams wrote:
> I want to display a value on the plot...my code is as follows..
>
> plot(a,b);
> hold on
> plot(a,c);
> axis([400 850 0 1]);
> legend('first','second');
> text(465,0.9,'Value=N(i)');
>
> I want to display the value stored in N(i) on the plot.When i used this code it displaying just that string. Instead i want to display the value stored.Thanks in advance!

text(465,0.9,sprintf('Value=%f',N(i)));
From: rams on
Hi Jrenfree and Walter....

Thanks for the help!
From: Wes on
rams <lramsb4u(a)gmail.com> wrote in message <398797414.369466.1276886957011.JavaMail.root(a)gallium.mathforum.org>...
> I want to display a value on the plot...my code is as follows..
>
> plot(a,b);
> hold on
> plot(a,c);
> axis([400 850 0 1]);
> legend('first','second');
> text(465,0.9,'Value=N(i)');
>
> I want to display the value stored in N(i) on the plot.When i used this code it displaying just that string. Instead i want to display the value stored.Thanks in advance!


.... or, if you'd like to do it the Matlab way:

text(465,0.9,['Value=' num2str(N(i)) ]);