Why is cell array of doubles converting to NaN
1 view (last 30 days)
Show older comments
I am reading in a .csv file with textscan:
y.Data = textscan(fileID, '%s%f%f%[^\n\r]', 'Delimiter', ',', ...
'EmptyValue' ,NaN,'HeaderLines', 1, ...
'ReturnOnError', false, 'TreatAsEmpty', '#VALUE!');
The first row is header text. The first column is a date time string. The remaining columns are numeric.
I then create variable names from the header text, and create a data structure with those names. I use the following to copy the imported data into the structure.
for chn = 1:y.nChan
y.Chan.(y.Name{chn}) = y.Data{chn};
end
Now if I look at y.Data{2} I see a cell array of doubles corresponding to the original data, but if I look at y.Chan.Signal1, for example, I see a cell array of doubles in which every value is NaN.
This has worked in the past, so not sure why it is not working now.
3 Comments
Answers (0)
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!