CSVファイルの時系列演算

15 visualizaciones (últimos 30 días)
海
el 12 de Oct. de 2022
Comentada: el 18 de Oct. de 2022
1.のような、ある物質の温度変化の様子が1秒ごとに時系列的に並んでいるCSVデータが100枚ほどあります。このデータを用いて、2.のようなグラフを作りたいのですが、全ての点を折れ線グラフにすることは可能でしょうか?
写真のような物質の温度変化の様子を、1点1点全て折れ線グラフにしたいです。
  10 comentarios
Keita Abe
Keita Abe el 14 de Oct. de 2022
時間が入っているセルはB3, 温度を取得したいセルがB9ならたとえば,for ループ 以下を次のように書き換えてみてはいかがでしょうか?
for i = 1:length(MyPath)
M = readmatrix(MyPath(i),'OutputType','string','NumHeaderLines',0);
time = datetime(M{3,2});
temperature = str2double(M{9,2});
TT{i,1} = time;
TT{i,2} = temperature;
end
TT = cell2table(TT);
plot(TT{:,1},TT{:,2})
海
el 17 de Oct. de 2022
ありがとうござます!
写真のように、1点グラフ化することに成功しました!
本当に感謝いたします。
さらに全点をグラフ化するには、どうプログラミングしたらいいでしょうか?

Iniciar sesión para comentar.

Respuesta aceptada

Keita Abe
Keita Abe el 17 de Oct. de 2022
Editada: Keita Abe el 18 de Oct. de 2022
最も愚直に書くとすれば以下のようにデータ取得に対してfor ループを回せばできますね。
clc;clear;
Pathlists = dir("*.csv");
Mylists = (struct2cell(Pathlists))';
Mylists = string(Mylists(:,1:2));
MyPath = fullfile(Mylists(:,2),Mylists(:,1));
for i = 1:length(MyPath)
M = readmatrix(MyPath(i),'OutputType','string','NumHeaderLines',0);
time = datetime(M{3,2});
TT{i,1} = time;
column =0;
for j = 0:479
for k = 0:359
column = column+1;
temperature = str2double(M{9+k,2+j});
TT{i,1+column} = double(temperature);
end
end
end
column = 0;
TT = cell2table(TT);
figure;
plot(TT{:,1},TT{:,2:end})
  1 comentario
海
el 18 de Oct. de 2022
ありがとうございます!
無事全ての点をプロットすることが出来ました。
つたない質問ばかりしてしまい、申し訳ございませんでした。
本当に感謝してもしきれないです。ありがとうございました!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre プログラミング en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!