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)
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
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)
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

More Answers (0)

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!