How can I plot sequential data of a matrix

2 visualizaciones (últimos 30 días)
Amir Mohammadi
Amir Mohammadi el 18 de Abr. de 2021
Comentada: Star Strider el 19 de Abr. de 2021
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
...

Respuesta aceptada

Star Strider
Star Strider el 18 de Abr. de 2021
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 comentarios
Amir Mohammadi
Amir Mohammadi el 19 de Abr. de 2021
That's awesome. As always, Thank you!
Star Strider
Star Strider el 19 de Abr. de 2021
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by