while using readtable comand for xlsx file, i get the table with cell value as text/cell, not in value format.
2 views (last 30 days)
Show older comments
Dharmik Patel
on 29 Mar 2023
Commented: Dharmik Patel
on 3 Apr 2023
I am facing MATLAB crash while using xls file, so i have to use xlsx format only.
I tried to import following excel (xlsx and xls)file by read table command. but the output of xlsx is different(Not acceptable, becase cell values are not in number form), how can I get the same output by xlsx as I got by xls?
>> Data_L1= readtable("Initialise.xls",Sheet="LAYOUT");
>> Data_L1= readtable("Initialise.xlsx",Sheet="LAYOUT");
Thanking you and looking forward to your feedback.
Accepted Answer
Cris LaPierre
on 29 Mar 2023
I would use the import options to set the parameters.
opts = detectImportOptions("Initialise.xlsx","Sheet","LAYOUT");
opts = setvartype(opts,"CR","double");
opts.MissingRule = "omitrow";
Data_L1= readtable("Initialise.xlsx",opts)
Another option is to read it in as numeric array using readmatrix
Data_L1= readmatrix("Initialise.xlsx","Sheet","LAYOUT","MissingRule","omitrow","Headerlines",1)
More Answers (0)
See Also
Categories
Find more on Spreadsheets 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!