How to convert 'NaN' to numeric NaN
10 views (last 30 days)
Show older comments
I have a 13x5 cell array which contains 4 'NaN' and I need to convert them from 'NaN'(string) to NaN(numeric). I have to use a nested loop as well the strcmp function but I don't know where to start.
0 Comments
Answers (1)
KALYAN ACHARJYA
on 5 Apr 2021
Is this?
>> str2num('NaN')
ans =
NaN
Or
data={2,5,NaN,6}
cell2mat(data)
#
data =
1×4 cell array
{[2]} {[5]} {[NaN]} {[6]}
ans =
2 5 NaN 6
More: What is NaN (Matlab)?
See Also
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!