Matlab printing legend data from vector

Feb 18 2012 Published under Programming | Tags:

Printing legend from vector

A=[0.1 0.37 0.5];
x = 0:0.01:1.5;

y = A'*x;

plot(x, y);
grid;
xlabel('X');
ylabel('Y');
str_A = str2num(sprintf('%0.2f ', A));  
str_A = strread(num2str(str_A), '%s');  
legend(str_A); 

reference:

http://web.me.com/innka/My_site/Science_blog/Entries/2010/7/7_MATLAB_tips_and_tricks.html

Tags:

No responses yet

Comments are closed at this time.

Login