For loop store variable with different dimension

1 Ansicht (letzte 30 Tage)
Rick Verberne
Rick Verberne am 17 Mär. 2018
Kommentiert: Rick Verberne am 19 Mär. 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

Akzeptierte Antwort

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by