Replacing Empty Cells by NaN
Mostrar comentarios más antiguos
Hi Matlab Community,
I would appreciate some help. I am importing an excel .csv file into a table. This file has multiple cells as empty cells. However, once imported as table in Matlab, some empty cells are filled with NaN while others show {0×0 char}. (Refer below)

I want to replace all empty cells in the table with NaN value, because using table2array function with {0×0 char} gives an error, which is as follows:
Error using table2array (line 37)
Unable to concatenate the table variables 'Var1' and 'Var16', because their types are double and cell.
Error in Berea_NTW1 (line 42)
node1 = table2array(node1Table) ;
Thanks a lot !!
1 comentario
Ive J
el 22 de Ag. de 2021
Woud you mind to share your data file? use paper clip to upload.
Respuesta aceptada
Más respuestas (1)
Simon Chan
el 22 de Ag. de 2021
T.Var1=NaN(size(T.Var1,1),1); % Replace T.Var1 by NaN
T.Var16=NaN(size(T.Var16,1),1); % Replace T.Var16 by NaN
Categorías
Más información sobre Tables en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!