readtable is interpreting columns of numbers from excel wrong

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
readtableproblem.PNG
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

the cyclist
the cyclist on 31 Oct 2019
Edited: the cyclist on 31 Oct 2019
Which column looks wrong to you?
I notice, for example, that the RodDiametermm columns looks like it is all numeric at the top ... but there is a cluster of non-numeric values ("in") starting at row 296 (as well as at other areas of that column).
Ditto for HoleDiametermm.

1 Comment

Ah! yes I see it now. I think I must have cut out those from a spreadsheet and saved it, then used the original instead of the new one for matlab by mistake.
Thanks so much for helping, it's cleared up a lot

Sign in to comment.

More Answers (1)

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

Products

Release

R2019a

Community Treasure Hunt

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

Start Hunting!