Info

此问题已关闭。 请重新打开它进行编辑或回答。

How i plot these values in Matlab 2015 version?

1 次查看(过去 30 天)
Time Allystar M8T F9P LS
15:27:31 -0.1788 -0.1246 -0.1553 -0.1248
16:27:31 -0.3784 -0.0922 0.0863 -0.1232
17:27:31 -0.026 0.0978 0.2577 0.3321
18:27:31 -0.0607 -0.149 -0.0981 0.0831
19:27:31 -0.9248 -0.6555 -0.7323 -0.745
20:27:31 -0.2253 -0.1903 -0.3662 -0.3096
21:27:31 -0.2381 -0.2125 -0.3155 -0.3181
22:27:31 -0.4784 -0.4363 -0.2506 -0.4413

回答(1 个)

Walter Roberson
Walter Roberson 2020-10-13
readtable().
In your version, those durations will come across as character vectors, and you will not (in your version) just be able to pass them to duration() in order to convert to HMS. However, you can
cell2mat(cellfun(@(s) sscanf(s, '%d:%d:%d', [1 inf]), Table.Variable, 'uniform', 0))
and pass that to duration() [you might have to split the columns into individual arguments.)
  2 个评论
SOMNATH MAHATO
SOMNATH MAHATO 2020-10-13
Thanks for your responce.
But it shows error.
If i change the time with numerical values then how it works. if posible send to me details programme.
Time Allystar M8T F9P LS
1 -0.1788 -0.1246 -0.1553 -0.1248
2 -0.3784 -0.0922 0.0863 -0.1232
3 -0.026 0.0978 0.2577 0.3321
4 -0.0607 -0.149 -0.0981 0.0831
5 -0.9248 -0.6555 -0.7323 -0.745
6 -0.2253 -0.1903 -0.3662 -0.3096
7 -0.2381 -0.2125 -0.3155 -0.3181
Walter Roberson
Walter Roberson 2020-10-13
Eek, your version was pretty primitive on reading table formats compared to current versions!
filename = 'allystar.txt';
fid = fopen(filename, 'rt');
tcell = textscan(fid, '%s%f%f%f%f', 'headerlines', 1);
fclose(fid);
t = table(tcell{:}, 'variablenames', {'Time', 'Allystar', 'M8T', 'F9P', 'LS'});
timeparts = cell2mat(cellfun(@(s) sscanf(s, '%d:%d:%d', [1 inf]), t{:,1}, 'uniform', 0));
t.times = duration(timeparts(:,1), timeparts(:,2), timeparts(:,3));
plot(t.times, t.Allystar, t.times, t.M8T, t.times, t.F9P, t.times, t.LS);
legend({'Allystar', 'M8T', 'F9P', 'LS'})

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by