How do I work with a two dimensional array with for loops in MATLAB?
24 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
How can I do two dimensions array using a FOR loop? Example:
P = {k,l,m,n};
L = 4;
for i=1:L
New(i) = P(i);
end
I don't know how can i do write that result was array in two dimension: New = {k,l,m,n;k,l,m,n;k,l,m,n;k,l,m,n};
0 commentaires
Réponse acceptée
Plus de réponses (1)
Sean de Wolski
le 24 Jan 2011
Best way would be:
New = repmat(P,4,1);
You should also read up on indexing cell arrays.
0 commentaires
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!