필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

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

조회 수: 1 (최근 30일)
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