How can I cut or split the data fast?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
the cyclist
am 8 Aug. 2017
Bearbeitet: the cyclist
am 8 Aug. 2017
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 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!