MATLAB: Remove empty rows from cell array

cellcell2matemptyMATLABmatrix

Hi, I have a cell array (attached) and would need to remove the rows with "" as they are empty fields, but still keep the rows with a 0. Is there a way I can do that and convert this cell array to a matrix? Currently, there is an error with i use cell2mat(A) as the fields are not the same data type.
Thank you! Appreciate any help

Best Answer

To replace string fields
idx = cellfun(@isstring, A);
A(idx) = {0};
After this, you can use
A = cell2mat(A)
Related Question