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!