Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Timeseries plots only first column after applying condition + how to select individual columns

1 visualización (últimos 30 días)
I have a timeseries already, but this effect happens even when I create ones myself. Say:
ts1 = timeseries(rand(20,5)); %this is one I created myself
Plotting ts1 by plot(ts1) or plot(ts1.Data) yields five lines as is expected.
Let's say I want to plot only the values of ts1 which have a time greater than 1 second. I do:
plot(ts1.Data(ts1.Time > 2))
This only yields one line corresponding to the column (Data:1), but with the correct condition applied. Why is this and how can I have all five lines plotted with the conditions in place?
Also, how do I select individual columns such as Data:3 for example?
  2 comentarios
Amritz Ansara
Amritz Ansara el 1 de Mzo. de 2021
Found out that I had to include both columns in when selecting which parts of ts1.Data to plot. This line of code gives me what I want (I realise greater than 1 second means > 1, not >2 as earlier - my mistake). Please close this question.
plot(ts2.Data(ts2.Time > 2, :)) %plots all lines greater than 2 seconds
ts2.Data(:, 3) %gives me Data:3 column

Respuestas (0)

La pregunta está cerrada.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by