Why is cell array of doubles converting to NaN
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!