combining variables into one variable
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Janis
le 21 Août 2014
Réponse apportée : Michael Haderlein
le 21 Août 2014
How to combine several variables into one variable? I have 28 variables with the same amount of data (tables 125x121) and I want to transform that into a one variable. Each variable is 125x121 double. I want to combine them all and get 28x125x121 double. How can I do that?
0 commentaires
Réponse acceptée
Michael Haderlein
le 21 Août 2014
I'd like to throw the cat function into the discussion:
X=cat(3,S000_010,S010_S020,...);
To your question in the comment on David Sanchez answer: You have a comma too much in your parenthesis and the first = doesn't make sense. It should be X(1,:,:)=S000...
Best regards, Michael
0 commentaires
Plus de réponses (1)
David Sanchez
le 21 Août 2014
Modifié(e) : David Sanchez
le 21 Août 2014
your_Combination = zeros(28,125,121); % initialize the final variable
Now you have several options depending on your data:
your_Combination = (1,:,:,) = table_1;
your_Combination = (2,:,:,) = table_2;
...
and so on
You could do it in a for-loop in case your tables allow it:
for k = 1:28
your_Combination = (k,:,:,) = table(k);
end
It all depends on the format of your tables.
Voir également
Catégories
En savoir plus sur Matrices and Arrays dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!