How to choose values from vector (150 000x1). When i need first 512 values for x, next 512 values for y and next 512 values for z. And separate vector by this style to the end

1 view (last 30 days)
Hello everyone,
I have vector aproximatly (150 000 x 1) and i need to separate values to separate vectors (x,y,z). First 512 values of global vector is for X, next 512 values is for Y and next 512 values is for Z. And this repeats to the end of the vector. Does anyone know, how to sort values please?
Thank you so much.

Answers (1)

dpb
dpb on 13 Dec 2021
XYZ=reshape(V,512,[]);
then process by column. Most MATLAB functions operate by column natively; depending upon what you're doing with the data, you may be able to do it all with vector operations.
NB: the "approximately 150000" elements will have to be exactly a multiple of 512 for the above to work without some bookkeeping to select the proper number overall or to augment to the next multiple.

Categories

Find more on Shifting and Sorting Matrices in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!