Problem with readtable MATLAB R2020a+
Show older comments
Hello,
I am trying to read a basilar table in MATLAB.
I wrote some scripts and I had no problem until version 2020a, where I see that there are huge changes in tables management functions.
Here are the call to readtable that I always use:
readtable(devices_file, 'Delimiter', ',', 'Format','%q%q')
Starting from R2020a, the readtable fails with this strange error:
Error using readtable (line 318)
Undefined function 'isnan' for input arguments of type 'string'.
Note: readtable detected the following parameters:
'HeaderLines', , 'ReadVariableNames', true
Also readtable with no arguments fails. I inspected into the core and the fail seems to go deep and it is correlated to DelimitedTextImportOptions or some other similar function.
Using detectImprtOptions the error is similar:
detectImportOptions(devices_file, 'Delimiter', ',', 'Format','%q%q')
also here its the same omitting the arguments.
Check for incorrect argument data type or missing argument in call to function 'isnan'.
Error in detectImportOptions (line 381)
throw(ME)
Do you know how to workaround this issue or if it is a bug that has to be resolved?
Sincerely,
Paolo Oliveri
6 Comments
Mathieu NOE
on 15 Jul 2021
hmm
this is what i get when i open your csv file

not really what I expected ...
Paolo Oliveri
on 15 Jul 2021
Edited: Paolo Oliveri
on 15 Jul 2021
Mathieu NOE
on 15 Jul 2021
I tested this on my R2020b without a problem
readtable('devices.csv', 'Delimiter', ',')
ans =
6×2 table
id name
__ ______________________________________
1 {'moored surface buoy' }
2 {'subsurface mooring' }
3 {'fixed benthic node' }
4 {'land/onshore structure' }
5 {'mooring' }
6 {'fixed subsurface vertical profiler'}
Paolo Oliveri
on 16 Jul 2021
Mathieu NOE
on 16 Jul 2021
W 10
Paolo Oliveri
on 16 Jul 2021
Accepted Answer
More Answers (1)
Christopher McCausland
on 15 Jul 2021
Hi Paolo,
I am hoping I have an answer for you however I am working in MATLAB 2020b, it is post 2020a so I think the changes should match up.
I believe the error message:
Undefined function 'isnan' for input arguments of type 'string'.
is generated as MATLAB is looking for the first input (i.e. the file name) in the readtable function to be a string, try changing to this;
readtable('devices_file.csv', 'Delimiter', ',', 'Format','%q%q') // note the added '' and .csv in the first input
this should hopefully prevent the isnan error, lastly double check the file name as the attached file was called "devices" and not "devices_file"
Let me know if this helps!
Christopher
1 Comment
Paolo Oliveri
on 15 Jul 2021
Categories
Find more on Data Type Identification 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!