How i plot these values in Matlab 2015 version?
Informazioni
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Mostra commenti meno recenti
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
Risposte (1)
Walter Roberson
il 13 Ott 2020
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 Commenti
SOMNATH MAHATO
il 13 Ott 2020
Walter Roberson
il 13 Ott 2020
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'})
Questa domanda è chiusa.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!