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!