Replace empty string with NaN in a cell
Mostrar comentarios más antiguos
I have a cell called A={ "20" "25" "25" [] "20" [] "25" "25" "25" "30"}
I would like to replace cell A with A={ "20" "25" "25" "NaN" "20" "NaN" "25" "25" "25" "30"}
Any help is highly appreciate, thank you.
Respuesta aceptada
Más respuestas (1)
Awais Saeed
el 23 de Ag. de 2021
Editada: Awais Saeed
el 23 de Ag. de 2021
clc;clear;close all;
A={ "20" "25" "25" [] "20" [] "25" "25" "25" "30"}
% get locations of empty cell elements
idx = cellfun('isempty',A);
% replace those empty cells with NaN
A(idx) = {NaN}
1 comentario
Daneisha Blair
el 23 de Ag. de 2021
Categorías
Más información sobre Cell Arrays 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!