How to replace values less than zero in a cell array with NaN?

6 vues (au cours des 30 derniers jours)
Iknoor Singh
Iknoor Singh le 22 Fév 2013
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.

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 22 Fév 2013
Modifié(e) : Azzi Abdelmalek le 22 Fév 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)

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by