COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Conversion to double from cell is not possible.

• Email
• 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

See related articles to this posting

```"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

```"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