Function to display variables in MATLAB figures
108 views (last 30 days)
Say I have to plot the following:
x = [3 4 5 6]; y = [6 7 8 9];
Say in some logic these vectors hold their value for 'case1' which holds an integer value 10 (say).
Now I want this integer -10 i.e. value of 'case1' to display when I plot a MATLAB figure say using plot(x,y). Is there a function that will insert this value onto my plot?
Chirag Gupta on 16 Aug 2011
Where do you want to insert this in the plot? You can insert this as a point on the existing graph using:
plot(-10,1,'xk'); % Whats the y coordinate for -10 ?
If you just want to insert it to annotate your graph, you can use:
If you want to place this as the title:
title(['case 1:' num2str(-10)]);