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.

 Réponse acceptée

dpb
dpb le 15 Jan 2021

2 votes

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.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by