MATLAB Answers

how can I see the x and y value table from an equation on matlab

71 views (last 30 days)
Emily  Vasquez
Emily Vasquez on 11 Feb 2020
Answered: fred ssemwogerere on 12 Feb 2020
x = 0:50:50;
y1 = 4*x;
y2= 100-4*x;
grid on
this allows me to plot the data
but I want to be able to see the value of y at some x, in some sort of chart or list

Answers (1)

fred  ssemwogerere
fred ssemwogerere on 12 Feb 2020
Hello, you could create a table from your variables using table
In case you want the list or table added to your plot, you could make use of annotation. (but this may be better suited to addition of simpler text not table). Something like this;
% First convert table to cell.
% vertical concantenate table variable names with its values and convert to a string
% set the x,y,width, and height (in that order) of a text box to be added to the plot for example;
txtdim=[.5 .5 .1 .1];
% add annotation to the plot specifying the string input argument as character array ("char(Tbl_str)")
For a more robust option to show text or your data in same graphics window, you could search in the documentation about uitable and annotation, or you could also refer to the link below:


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!