How to fix: Cell contents assignment to a non-cell array object?

2 ビュー (過去 30 日間)
adi kul
adi kul 2016 年 6 月 13 日
回答済み: adi kul 2016 年 6 月 13 日
Following is the part of my code where I am getting 'Cell contents assignment to a non-cell array object' error.
for kk = 1:2
switch choosePara(kk)
case 4
[FileName,PathName] = uigetfile({'*.txt';'*.csv';'*.*'},'Select the text file that contains the data')
paramMat{kk}{end+1} = FileName;
paramMat{kk}{end+1} = PathName;
case 8
[FileName,PathName] = uigetfile({'*.txt';'*.csv';'*.*'},'Select the text file that contains the data');
paramMat{kk}{end+1} = FileName;
paramMat{kk}{end+1} = PathName;
end
end
I am working on the GUI of my code where this error is coming. The code does assign values to FileName and PathName but still gives this error on:
paramMat{kk}{end+1} = FileName;
Is there anything I can do to fix this? Also can anyone explain why this error is coming?

採用された回答

adi kul
adi kul 2016 年 6 月 13 日
Found the solution: The paraMat array was defined with [] brackets which should be defined by {} where remaining code was calling this array.

その他の回答 (1 件)

Guillaume
Guillaume 2016 年 6 月 13 日
Well, clearly either paramMat is not a cell array, or the cell at paramMat{kk} does not contain a cell array. Your code is expecting a cell array of cell arrays.
How is paramMat created?
  1 件のコメント
adi kul
adi kul 2016 年 6 月 13 日
Thank you for the suggestion. Actually I messed up the brackets!

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by