Hello guys, i have a question. I have a signal (ECG) in a vector with 1column 4000 rows and i want to extract every 1000 elements and load them in 4 different vectors with 1column and 1000rows. One way is for example to do g=x(1:1000), z=x(1001:2000) etc x is the initial vector, but i want a better way, more beautiful.

 採用された回答

dpb
dpb 2021 年 1 月 15 日

2 投票

Don't create new variables, just
x=reshape(x,1000,[]).';
and reference the column of interest.
If you create new variables, you then have to write code to explicitly address each one; this way just change an index.

1 件のコメント

Andreas Parlani
Andreas Parlani 2021 年 1 月 15 日
Thanks for your response, very usefull !

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by