how to transfer elements in cell into matrix in MATLAB?

1 visualización (últimos 30 días)
I am trying to transfer elements in (1*1) cell which has one column matrix into another column matrix using while loop..and I am getting "Subscripted assignment dimension mismatch." error..can anyone please explain whats the problem..or any other way to do the same thing?
  1 comentario
siddhesh rane
siddhesh rane el 22 de Mayo de 2013
I m trying to use following code-
P(1,1) = C{1,1}{11,1};
Which I think should transfer C{1,1}{11,1} into matrix P's first row and first column..but its showing "Subscripted assignment dimension mismatch." error.

Iniciar sesión para comentar.

Respuesta aceptada

David Sanchez
David Sanchez el 22 de Mayo de 2013
A=ones(3,1);
C=cell(1);
C{1} = A; %matrix to cell
B = cell2mat(C)
>>B =
1
1
1
  2 comentarios
siddhesh rane
siddhesh rane el 22 de Mayo de 2013
Can you please explain whats wrong with this-->>
P(1,1) = C{1,1}{11,1};
Which I think should transfer C{1,1}{11,1} into matrix P's first row and first column..but its showing "Subscripted assignment dimension mismatch." error.
siddhesh rane
siddhesh rane el 22 de Mayo de 2013
Actually i have some text data in my cell..and i think i have to use loop to transfer only numerical data in matrix..

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by