Convert Cell to Matrix

7 visualizaciones (últimos 30 días)
ha ha
ha ha el 26 de Jun. de 2019
Respondida: madhan ravi el 26 de Jun. de 2019
Let' say, I have cell_A: 5x1 cell
cell_A={ [] ; [1] ; [5]; [] ; [2]};
How can I convert it to be matrix? 5-by-1 matrix
result_matrix=[ []; 1; 5 ; [] ; 2 ];

Respuesta aceptada

madhan ravi
madhan ravi el 26 de Jun. de 2019
As sir Walter mentioned already , you cannot have holes in matrices . So you could replace them with nans perhaps:
cell_A(cellfun('isempty',cell_A)) = {NaN};
Matrix = cell2mat(cell_A)

Más respuestas (1)

Walter Roberson
Walter Roberson el 26 de Jun. de 2019
You cannot. Matrices cannot have "holes" in them.

Categorías

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

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by