How to figure out if an array is ordinary or cell?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Sam136
el 7 de Jul. de 2015
In my code, variable (A) can be either an ordinary array or cell array. How can I do following
If (A) is an ordinary array then do nothing If (A) is a cell array then cell2mat(A)
0 comentarios
Respuesta aceptada
bio lim
el 7 de Jul. de 2015
Editada: bio lim
el 8 de Jul. de 2015
tf = iscell(A);
if tf == 1
A =cell2mat(A)
end
2 comentarios
Steven Lord
el 7 de Jul. de 2015
Two comments:
- You don't need to use == 1 here.
- You need to return an output argument from CELL2MAT, otherwise you're making a matrix from the cell array then throwing that matrix away.
Más respuestas (0)
Ver también
Categorías
Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!