MATLAB: How could I extract a column within a timetable

timetable

I created a timetable. The first column is the timestamp, then followed by different variables measured over time. I want to plot a scatter plot by using the timestamp as my x-axis and a couple of other variables on my y-axis. I tried to convert my variables into a separate column out of the timetable so that I could call the vairables when plotting them with my timestamp. I tried to use splitvars to split my variables but it did not seem to work. Thanks!

Best Answer

x = YourTable.Properties.RowTimes;
y1 = YourTable.FirstInterestingVariable;
y2 = YourTable.SecondInterestingVariable;
pointsize = 15;
scatter(x, y1, pointsize, 'b')
hold on
scatter(x, y2, pointsize, 'r');
hold off
legend({'First Interesting Variable', 'Second Interesting Variable'});
Related Question