Conversion to double from cell is not possible.

  • Follow


Hya
I create two things(hum I don't know how to call them!! may be cells !!) like this
a = zeros(100,100)
b = cell(100)

and when I try to fill the first table doing for exemple

a(1,5) = b(5,4)

I have this error message : ??? Conversion to double from cell  is not possible.

Can anyone help me please !!!!

Thank you 
0
Reply Giga 5/3/2010 2:14:05 PM

"Giga Babs" <bdmendy@gmail.com> wrote in message 
news:hrmlnd$p7m$1@fred.mathworks.com...
> Hya
> I create two things(hum I don't know how to call them!! may be cells !!) 
> like this
> a = zeros(100,100)
> b = cell(100)

a is a numeric matrix; b is a cell array.  If you want one term to cover 
them both, variables would do.

> and when I try to fill the first table doing for exemple
>
> a(1,5) = b(5,4)
>
> I have this error message : ??? Conversion to double from cell  is not 
> possible.
>
> Can anyone help me please !!!!

If you want to put the _contents_ of the cell in row 5, column 4 of the cell 
array b into the element in row 1, column 5 of a then you need to use curly 
brace indexing on your cell array:

a(1, 5) = b{5, 4}

When used for indexing, parentheses generally return a variable of the same 
class as the variable into which you're indexing.  Curly braces, when used 
for cell arrays, returns the contents of a cell or cells, not the cell or 
cells themselves.

-- 
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ 


0
Reply Steven 5/3/2010 3:03:20 PM


"Giga Babs" <bdmendy@gmail.com> wrote in message <hrmlnd$p7m$1@fred.mathworks.com>...
> Hya
> I create two things(hum I don't know how to call them!! may be cells !!) like this
> a = zeros(100,100)
> b = cell(100)
> 
> and when I try to fill the first table doing for exemple
> 
> a(1,5) = b(5,4)
> 
> I have this error message : ??? Conversion to double from cell  is not possible.
> 
> Can anyone help me please !!!!
> 
> Thank you 

this does not work they way you show it

% correct syntax
     a(1,5)=b{5,4};
% BUT: since B is an empty CELL array - according to your snippet -
% it will still throw an error because
     a(1,5)=[]
% is wrong... and yields a
% ??? Subscripted assignment dimension mismatch.

us
0
Reply us 5/3/2010 3:14:24 PM

2 Replies
1235 Views

(page loaded in 0.098 seconds)

Similiar Articles:













7/23/2012 12:21:40 AM


Reply: