Replace 32767 with NaN in entire table
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Marcel345614
le 26 Jan 2022
Commenté : Marcel345614
le 27 Jan 2022
I have a timetable with some strange values(32767 (probably Inf)) in all columns of my table.
How can I replace all these with NaN's ?
I tried the following, but it didn't work:
% Method 1
Data(Data==32767)=NaN;
%Method 2
for j=1:size(Data,2)
Data(Data(:,j)==32676,j)=NaN;
end
0 commentaires
Réponse acceptée
ANKUR KUMAR
le 26 Jan 2022
Modifié(e) : ANKUR KUMAR
le 26 Jan 2022
You can get the table in a matrix form using .Variables. Once you have a matrix, then you can use boolean to replace any numbers with nan. Here is an example of replacing 48.9 with nan.
load outdoors
tt=outdoors(1:5,:);
mat = tt.Variables;
mat(mat==48.9) = nan;
tt.Variables = mat
3 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Characters and Strings 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!