Remove empty rows from cell array

3 views (last 30 days)
Cside on 3 Oct 2020
Commented: Cside on 3 Oct 2020
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
Cside on 3 Oct 2020
Edited: Cside on 3 Oct 2020
Hi, how could i clean that up to return a 359 x1 column matrix? and thereafter remove the missing rows? thanks!

Sign in to comment.

Accepted Answer

Mario Malic
Mario Malic on 3 Oct 2020
To replace string fields
idx = cellfun(@isstring, A);
A(idx) = {0};
After this, you can use
A = cell2mat(A)

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by