while using readtable comand for xlsx file, i get the table with cell value as text/cell, not in value format.

1 次查看(过去 30 天)
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.

采纳的回答

Cris LaPierre
Cris LaPierre 2023-3-29
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)
Data_L1 = 3×1 table
CR __ 2 1 3
Another option is to read it in as numeric array using readmatrix
Data_L1= readmatrix("Initialise.xlsx","Sheet","LAYOUT","MissingRule","omitrow","Headerlines",1)
Data_L1 = 3×1
2 1 3

更多回答(0 个)

产品


版本

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by