how i can solve this error ''Cell contents assignment to a non-cell array object''.

1 回表示 (過去 30 日間)
hello every one,who can help me to solve this error.
"Cell contents assignment to a non-cell array object."
emails=['ibadal@gmail.com';'qzaman@msn.com';'dfoorno@msn.com';'myey@hotmail.com';'qkemal@myspace.com';'zvarfi@gmail.com';'vlul@mynet.com';'uwardo@msn.com';'izaman@hotmail.com''htimiro@myspace.com'];
data=[2 0 2; 0 0 0;0 0 0; 0 2 0;0 0 0; 0 0 13;0 0 18];
test=cellfun(@(c)sprintf('%d',c),mat2cell(data,ones(size(data,1),1),size(data,2)),'uniform',false);
for steg_col=1:length(emails)
admin=1;
[e_names(admin,steg_col),e_address(admin,steg_col)]=strtok(k1(steg_col),'@');
end
[str_gr_row,str_gr_col]=size(test);
for ob=1:str_gr_col
for mr=1:str_gr_row
elists{mr,ob}=test{mr,ob};
if(elists(mr,ob)==0)
kmk(mr,ob)=strcat(e_names(mr,ob),e_address(mr,ob))
else
kmk(mr,ob)=strcat(e_names(mr,ob),elists(mr,ob),e_address(mr,ob))
end
end
end
  3 件のコメント
Stephen23
Stephen23 2015 年 5 月 9 日
編集済み: Stephen23 2015 年 5 月 9 日
@abdulkarim hassan: Where does the error happen? According to the message on line 369... but where is line 369? You have not provided 369 lines of code, so how are we supposed to know where the error is? We rely on you actually giving information to us so that we can help you. Sorry, but we cannot read minds. You need to help us by actually giving complete, unedited information.
You current code would never work anyway, lets try the very first line:
>> emails = ['ibadal@gmail.com';'qzaman@msn.com';'dfoorno@msn.com';'myey@hotmail.com';'qkemal@myspace.com';'zvarfi@gmail.com';'vlul@mynet.com';'uwardo@msn.com';'izaman@hotmail.com''htimiro@myspace.com'];
??? Error using ==> vertcat
CAT arguments dimensions are not consistent.
Perhaps you meant to use curly braces {} instead.
Please help us by actually giving us the complete code that you are using by uploading it using the paperclip button. Note that you will need to push both buttons: Choose file and Attach file.
Mohamuud hassan
Mohamuud hassan 2015 年 5 月 9 日
emails={'ibadal@gmail.com';'qzaman@msn.com';'dfoorno@msn.com';'myey@hotmail.com';'qkemal@myspace.com';'zvarfi@gmail.com';'vlul@mynet.com';'uwardo@msn.com';'izaman@hotmail.com';'htimiro@myspace.com'};
data=[2 0 2; 0 0 0;0 0 0; 0 2 0;0 0 0; 0 0 13;0 0 18];
test=cellfun(@(c)sprintf('%d',c),mat2cell(data,ones(size(data,1),1),size(data,2)),'uniform',false);
for steg_col=1:length(emails)
admin=1;
[e_names(admin,steg_col),e_address(admin,steg_col)]=strtok(emails(steg_col),'@');
end
[str_gr_row,str_gr_col]=size(test);
for ob=1:str_gr_col
for mr=1:str_gr_row
elists{mr,ob}=test{mr,ob};
end
if(elists(mr,ob)==0)
kmk(mr,ob)=strcat(e_names(mr,ob),e_address(mr,ob))
else
kmk(mr,ob)=strcat(e_names(mr,ob),elists(mr,ob),e_address(mr,ob))
end
end
sorry my friend, the error has been changed to another one which is:
Undefined function 'eq' for input arguments of type 'cell'.
Error in kuday (line 15)
if(elists(mr,ob)==0)
and i dont have any eq vector.

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

採用された回答

Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh 2015 年 5 月 9 日
Hi Abdu,
you have some evident problem in your code. the variable elists is not a cell.
I think you may have defined it before line 369 as something rather than a cell.
Anyhow, you're using elists in line 370 as an array!
if(elists(mr,ob)==0)
You can't use parenthesis ( ) to index a cell array! you have to use { }
So make sure what type is elists and then use appropriate { or (
good luck
  2 件のコメント
Stephen23
Stephen23 2015 年 5 月 9 日
編集済み: Stephen23 2015 年 5 月 12 日
"You can't use parenthesis ( ) to index a cell array" is incorrect: you can certainly use parentheses to index cell arrays, and this returns the cells, not the contents, as the documentation clearly states:
Mohamuud hassan
Mohamuud hassan 2015 年 5 月 9 日
Salaheddin Hosseinzadeh and Stephen Cobeldick thank you for the support.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by