How to plot data from a single day?
6 views (last 30 days)
Show older comments
Arthur Romeu
on 25 Oct 2019
Commented: Arthur Romeu
on 30 Oct 2019
Hello everyone! I am currently a novice on the matlab world.
I have a table that goes as such:
"10-Jul-2019 -24.129 -40.848
10-Jul-2019 -24.129 -40.818
10-Jul-2019 -24.132 -40.512
10-Jul-2019 -24.132 -40.393
13-Jul-2019 -24.578 -40.304
14-Jul-2019 -24.675 -41.144
14-Jul-2019 -24.573 -40.959
14-Jul-2019 -24.573 -40.798
14-Jul-2019 -24.573 -40.798
14-Jul-2019 -24.574 -40.679
14-Jul-2019 -24.573 -40.569
14-Jul-2019 -24.574 -40.507
15-Jul-2019 -24.682 -40.93
17-Jul-2019 -24.761 -41.586 "
And I want to plot a different chart for each day.
Does anyone know how to do this?
Thanks!!
0 Comments
Accepted Answer
Star Strider
on 25 Oct 2019
If ‘T1’ is your table, and y0ou defined it with a datetime array as the first column try this:
G = findgroups(day(T1{:,1}));
DayGroups = accumarray(G, (1:size(G,1))', [], @(x){T1(x,:)});
Example —
for k = 1:size(DayGroups,1)
figure(k)
plot(DayGroups{k}{:,1}, DayGroups{k}{:,2:end}, '-p')
grid
end
This worked with data that I already have in a similar table that I have already defined. I have no idea what your table actually is, or how you have defined it, so I cannot use the text that you posted.
6 Comments
More Answers (0)
See Also
Categories
Find more on Data Preprocessing 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!