Info

This question is closed. Reopen it to edit or answer.

How can i break down the values of vector into group of five?

1 view (last 30 days)
Here, i want to read first 5 values of the vector and after that i want to read next 5 values of same vector continously.
0.6137
0.8946
1.1238
1.5200
2.9336
9.9637
10.3845
10.5308
10.8468
12.0193
16.5591
16.9117
17.0800
17.6835
19.9467
24.6567
24.9646
25.1283
25.5325
26.3262
29.9249
30.1739
30.3119
30.6054
31.4281
34.2383
34.5242
34.6736
35.6291
36.3185
39.1514
39.4394
39.5863
39.9892
40.6942
45.1461
45.3931
45.6263
45.9219
46.6433
49.6028
49.8943
50.0356
50.5986
51.3305
54.3656
54.6409
54.7636
55.0352
57.0281

Answers (1)

Fabio Freschi
Fabio Freschi on 29 Oct 2019
If x is your vector you can reshape it
y = reshape(x,5,numel(x)/5);
and access each column with indexing
% column 10
iCol = 10;
y(:,iCol)
  2 Comments
Fabio Freschi
Fabio Freschi on 30 Oct 2019
this is not a good programming choice. Look the discussion here:
There are bunch of alternatives, the access to the variable columns is one of these.

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!

Translated by