How could I extract a column within a timetable?
74 views (last 30 days)
Show older comments
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!
0 Comments
Accepted Answer
Walter Roberson
on 21 Aug 2020
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'});
0 Comments
More Answers (0)
See Also
Categories
Find more on Scatter Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!