How can I cut or split the data fast?
4 ビュー (過去 30 日間)
古いコメントを表示
I have some data like
A =
2 3 4
2 3 4
2 3 4
5 3 2
5 3 2
5 3 2
9 4 2
9 4 2
9 4 2
or
B=
3 5 6
7 8 1
4 9 0
3 5 6
7 8 1
4 9 0
and I want to split this data like this
a1 = a2 = a3 =
2 3 4 5 3 2 9 4 2
2 3 4 5 3 2 9 4 2
2 3 4 5 3 2 9 4 2
or
b1= b2=
3 5 6 3 5 6
7 8 1 7 8 1
4 9 0 4 9 0
This is easy question if i use 'for loop' but, I will work with large data so speed is very important for me
is there any way to solve this issue without 'for loop'??
0 件のコメント
回答 (1 件)
the cyclist
2017 年 8 月 8 日
編集済み: the cyclist
2017 年 8 月 8 日
It is a very bad idea to name variables like this. You can find scores of posts here about that.
What is your underlying purpose for this? What is your next step? An alternative would be to simply reshape your array:
A_r = reshape(A,3,3,[]);
and then access, for example,
A_r(:,:,1)
in the same way you would have used a1.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!