Info

この質問は閉じられています。 編集または回答するには再度開いてください。

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

1 回表示 (過去 30 日間)
Amritz Ansara
Amritz Ansara 2021 年 2 月 28 日
閉鎖済み: Amritz Ansara 2021 年 3 月 3 日
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 件のコメント
Amritz Ansara
Amritz Ansara 2021 年 3 月 1 日
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
Mathieu NOE
Mathieu NOE 2021 年 3 月 3 日
hi
you are the only one allowed to close the question
please do

回答 (0 件)

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by