Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

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

1 Ansicht (letzte 30 Tage)
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 Kommentare
Amritz Ansara
Amritz Ansara am 1 Mär. 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

Antworten (0)

Diese Frage ist geschlossen.

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by