How can I plot sequential data of a matrix

1 回表示 (過去 30 日間)
Amir Mohammadi
Amir Mohammadi 2021 年 4 月 18 日
コメント済み: Star Strider 2021 年 4 月 19 日
Hello, I've derived my data from a software and it gives the data in a sequential format. It's a 2-column matrix in which the first column is X and the second one is Temperature of that point. X starts from 0 to 0.2, then I have another 0 to 0.2 and this pattern repeats. The first X from 0 to 0.2 and its pertaining T are corrosponding values for first time step and the next one is for the next time step, ... . The number of rows are not fixed for every iteration and total number of rows are unknown. I want to plot X vs T for every time step. Does anyone have an idea for defining the matrix?
0 329.62
0.01 329.61
0.014 329.60
0.2 329.59
0.00 329.63
0.05 329.62
0.10 329.64
0.15 329.68
0.20 3295
0 329
...

採用された回答

Star Strider
Star Strider 2021 年 4 月 18 日
Try this:
A = [0 329.62
0.01 329.61
0.014 329.60
0.2 329.59
0.00 329.63
0.05 329.62
0.10 329.64
0.15 329.68
0.20 329.5
0 329];
is0 = find(A(:,1) == 0);
for k = 1:numel(is0)-1
idxrng = is0(k):is0(k+1)-1
segment{k} = A(idxrng,:);
end
figure
hold on
for k = 1:numel(segment)
plot(segment{k}(:,1), segment{k}(:,2), '.-')
end
hold off
grid
xlabel('X')
ylabel('T')
I have no idea how robust it will be for the full data set, however it works on the sample posted.
  8 件のコメント
Amir Mohammadi
Amir Mohammadi 2021 年 4 月 19 日
That's awesome. As always, Thank you!
Star Strider
Star Strider 2021 年 4 月 19 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by