Effacer les filtres
Effacer les filtres

For loop store variable with different dimension

4 vues (au cours des 30 derniers jours)
Rick Verberne
Rick Verberne le 17 Mar 2018
Commenté : Rick Verberne le 19 Mar 2018
Hi all,
I have a question about storing the results from a for loop. The problem is that each round results in a vector of different size. I thought creating an cell should work, but I'm clearly (doing something) wrong. Other option, maybe? would be to fill the "empty" places in the matrix with zeros.
Best,
Rick

Réponse acceptée

Von Duesenberg
Von Duesenberg le 17 Mar 2018
A cell should work fine:
C = cell(2,1);
C{1} = [1 2 3];
C{2} = [1 2 3 4];
  1 commentaire
Rick Verberne
Rick Verberne le 19 Mar 2018
Thank you, it works indeed. I was mixing the type of brackets to used.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements 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!

Translated by