readtable is interpreting columns of numbers from excel wrong
Show older comments
I have a spreadsheet with a few colomns of numbers. MatLab seems to recognise some of these as numbers but others seem to be cells?
Springs = readtable("SpringsLS.xlsx")
An image of the output below

Even when I move the colomns around and ensure formatting is the same it still makes my numbers into these, which I cant work with.
I've attached the excel doc
Accepted Answer
More Answers (1)
Mohammad Sami
on 1 Nov 2019
You can try and explicitly specify the format of your data.
opts = detectImportOptions('SpringsLS.xlsx');
disp(opts);
disp(opts.VariableTypes);
% use the following to set the conversion options if needed
% opts = setvartype(opts,{'RodDiametermm','HoleDiametermm'},'double');
data = readtable("SpringsLS.xlsx",opts);
Categories
Find more on Data Import from MATLAB 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!