isempty error cell contents referencefrom a non-cell array object

if true
% code
end
k=1;K=1;j=1;
for i = 1:length(dir)
currFile = dirList(i).name;
mnemonic=[];
if( length(currFile) < 50)
else
if strcmp('ts_pcs_5060',currFile(1:11))
mnemonic = currFile(1:32);
pcs_data_5060{k}=currFile;
k=k+1;
else strcmp('ts_pcs_012',currFile(1:10))
pcs_data_012{j}=currFile;
j=j+1;
end
end
end
nombre_de_fichiers=numel(pcs_data_012);
for xyz=1:nombre_de_fichiers
if ~isempty (pcs_data_5060{xyz});
filename_pcs5060=pcs_data_5060{xyz};
filename_raw5060=raw_data_5060{xyz};
RAW_5060=load(filename_raw5060);
RAW_pcs5060=load(filename_pcs5060);
else continue
end
if ~isempty (raw_data_012{xyz});
filename_raw012=raw_data_012{xyz};
filename_pcs012=pcs_data_012{xyz};
RAW_012=load(filename_raw012);
RAW_pcs012=load(filename_pcs012);
else continue
end
end
% The following error "??? Cell contents reference from a non-cell array object.
Error in ==> my_test at 162
if ~isempty (raw_data_012{xyz});"
is actually appearing every time "(raw_data_012{xyz})=[]"
I think the solution is easy but it is taking me lots of time and am not able to find it, can anyone help please ?
Many thanks
LE FOU

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 9 月 2 日

0 投票

Maybe raw_data_012 is not a cell array? Type
raw_data_012
What do you get?

11 件のコメント

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 9 月 2 日
編集済み: Azzi Abdelmalek 2013 年 9 月 2 日
LE FOU commented
Hi Abdelmalek
raw_data_012= []
thanks
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 9 月 2 日
Sorry type
whos raw_data_012
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 9 月 2 日
If a is not a cell array, for example
a=2
a{1}
you will get the same message
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 9 月 2 日
Le Fou, please, to add a comment, click on comment on this answer instead of answering your question
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 9 月 2 日
Le Fou commented
Name Size Bytes Class Attributes
raw_data_012 0x0 0 double
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 9 月 2 日
編集済み: Azzi Abdelmalek 2013 年 9 月 2 日
raw_data_012 is an empty double array. You can't use curly brackets { } , used only with cell array. Also your array is empty. what are you expecting with raw_data_012{xyz}
LE FOU
LE FOU 2013 年 9 月 2 日
ok so what is the solution ? if I use parenthesis it won't work too
thanks
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 9 月 2 日
Your array is empty, what solution are you expecting from us?
LE FOU
LE FOU 2013 年 9 月 2 日
What I want to do is if the array is empty that matlab will jump to else continue that's all
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 9 月 2 日
Then use
if ~isempty (raw_data_012)
LE FOU
LE FOU 2013 年 9 月 2 日
ok thanks

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by