how make multiple cut or crop of time series

4 ビュー (過去 30 日間)
RichardB
RichardB 2020 年 2 月 14 日
コメント済み: Star Strider 2020 年 2 月 14 日
I've got multiple time series. One has gaps and was concatenated when exported to a Mat file. Now some of the data was continuous and much longer than the concatenated. I need a way to cut the sections out of the continuous data at known time points and duration. I wanted to do something like this, but it obviously does not work.
SpeedCropped = Speed(1318:1409 1903:2065 2278:2445);
Is it possible? What is the correct syntax or do I have to do this 9 times?
Thanks

採用された回答

Star Strider
Star Strider 2020 年 2 月 14 日
We do not know the dimensions of ‘Speed’. Assuming it is a vector, to concatenate the indices, enclose them in square brackets:
SpeedCropped = Speed([1318:1409 1903:2065 2278:2445]);
If there are more dimensions, add additional default dimensions, such as for ‘Speed’ being a 2D matrix, where you are addressing the rows:
SpeedCropped = Speed([1318:1409 1903:2065 2278:2445],:);
or:
SpeedCropped = Speed(:,[1318:1409 1903:2065 2278:2445]);
if you are addressing the columns.
  2 件のコメント
RichardB
RichardB 2020 年 2 月 14 日
Thanks. Should have known that.
Star Strider
Star Strider 2020 年 2 月 14 日
As always, my pleasure!
No worries! Not everything in MATLAB is immediately obvious, and there is a lot to remember about it.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by