For loop store variable with different dimension

5 ビュー (過去 30 日間)
Rick Verberne
Rick Verberne 2018 年 3 月 17 日
コメント済み: Rick Verberne 2018 年 3 月 19 日
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

採用された回答

Von Duesenberg
Von Duesenberg 2018 年 3 月 17 日
A cell should work fine:
C = cell(2,1);
C{1} = [1 2 3];
C{2} = [1 2 3 4];
  1 件のコメント
Rick Verberne
Rick Verberne 2018 年 3 月 19 日
Thank you, it works indeed. I was mixing the type of brackets to used.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by