How can I cut or split the data fast?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
the cyclist
le 8 Août 2017
Modifié(e) : the cyclist
le 8 Août 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 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!