How to replace values less than zero in a cell array with NaN?
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a huge cell array and there is a column with a lot of negative values. I want to clean up and replace all those values with NaN. Would appreciate any help. Thanks.
0 comentarios
Respuesta aceptada
Azzi Abdelmalek
el 22 de Feb. de 2013
Editada: Azzi Abdelmalek
el 22 de Feb. de 2013
% for all columns
B=cell2mat(A)
B(B<0)=nan
A=num2cell(B)
%if column 2 for e.g
B=cell2mat(A)
B(B(:,2)<0,2)=nan
A=num2cell(B)
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!