How to read values from excel file with mobile matlab app?
Show older comments
Hi, I want to read values from Excel file with the Matlab mobile app but It seems to do not read correctly! With the same code on PC works fine! What can be the reason? filename = 'Acceleration.xls'; sheet = 'Raw Data'; xlRange = 'D:D'; columnD = xlsread(filename,sheet,xlRange)
9 Comments
Dyuman Joshi
on 12 Dec 2023
If there is still a problem or you encounter an error, please specify in detail what the issue is.
Kalin Chuchuganov
on 12 Dec 2023
Dyuman Joshi
on 12 Dec 2023
Edited: Dyuman Joshi
on 12 Dec 2023
If you are using readmatrix(), it should automatically read the numbers/numeric data only, discarding the 1st row containing titles/names of column.
Kalin Chuchuganov
on 12 Dec 2023
Walter Roberson
on 12 Dec 2023
readmatrix() will NOT discard the row and column of text. Instead it will insert NaN in place of the data.
I recommend readtable() and accessing the column by variable name.
Dyuman Joshi
on 12 Dec 2023
I overlooked the fact that you provided a range as input.
In that case, one option is to delete the first row.
Other option is to modify the range option, but that requires knowing the last row value of the data. Since this is hardcoding the value, it is a less preferred option in general.
filename = 'Acceleration.xls';
sheet = 'Raw Data';
%Say the last row is 26
xlRange = 'D2:D26';
columnD = readmatrix(filename,sheet,'Range',xlRange)
Kalin Chuchuganov
on 13 Dec 2023
Walter Roberson
on 13 Dec 2023
Sorry, I overlooked the range too. readmatrix()
You will probably need
columnD = readmatrix(filename, 'sheet', sheet, 'Range', xlRange)
Kalin Chuchuganov
on 13 Dec 2023
Accepted Answer
More Answers (0)
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!