Cell Array Error Correction

7 ビュー (過去 30 日間)
Franco
Franco 2016 年 4 月 5 日
編集済み: Ryan Povall 2016 年 4 月 7 日
Anyone out there know why I keep getting this error (Cell contents assignment to a non-cell array object) and how to correct it.
for i = 1:2
var1{i} = rand(2,2)
end

回答 (1 件)

Ryan Povall
Ryan Povall 2016 年 4 月 7 日
編集済み: Ryan Povall 2016 年 4 月 7 日
My guess is that you have used var1 as a different data type before executing this code. I am able to copy and paste this into my MATLAB command window and run without error. I suggest changing "var1" to a different variable name or use the command "clearvars" (as seen in this documentation page: http://www.mathworks.com/help/matlab/ref/clearvars.html ). Make sure you are using the same variable name for consistent data types. I hope this helps.
Ryan

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by