how can i store all the different values in one variable or matrix?

1 回表示 (過去 30 日間)
ocsse
ocsse 2018 年 5 月 1 日
コメント済み: Ameer Hamza 2018 年 5 月 1 日
Hi all! I'm getting an error: Unable to perform assignment because the size of the left side is 1-by-24 and the size of the right side is 1-by-63.
I know why I'm getting this error. but is there a way to store all the char data in example variable? even though they have different columns dimensions
for n = 1:length(i)
example(n,:) = decode(matrix(n,:), x)
end

採用された回答

Ameer Hamza
Ameer Hamza 2018 年 5 月 1 日
Using matrix, it is not possible, unless you are ready to add zeros at the end of the vector to make length equal. The proper way to do this is to use cell array. Do it as follow,
example = cell(1, length(i));
for n = 1:length(i)
example{n} = decode(matrix(n,:), x)
end
  2 件のコメント
ocsse
ocsse 2018 年 5 月 1 日
Thanks!
Ameer Hamza
Ameer Hamza 2018 年 5 月 1 日
You are welcome.

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

その他の回答 (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