Info

この質問は閉じられています。 編集または回答するには再度開いてください。

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

1 回表示 (過去 30 日間)
rupak katwal
rupak katwal 2019 年 10 月 29 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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

回答 (1 件)

Fabio Freschi
Fabio Freschi 2019 年 10 月 29 日
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 件のコメント
rupak katwal
rupak katwal 2019 年 10 月 29 日
編集済み: rupak katwal 2019 年 10 月 29 日
I want this values of vector split in the group of five,
group1=(first five values)
group2=(next five values)
group3=(next five values)
.......
Fabio Freschi
Fabio Freschi 2019 年 10 月 30 日
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.

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by