reading from excel by page

3 views (last 30 days)
Kris Lawson
Kris Lawson on 23 Mar 2016
Commented: Kris Lawson on 26 Mar 2016
Hello,
I'm looking to read from 1 excel document that consists of 3 pages of information(EMG) each consisting of 19col. 44000rows
I would like to know how to manipulate cells from seperate pages as well as how to cross corolate between pages, if at all possible. (would it be easier from a text file?)
Any help would be greatly appreciated.
1st time Matlab user.
  3 Comments
Kris Lawson
Kris Lawson on 24 Mar 2016
yes the information is 3 sheets for pre, post, and follow up. The data on each sheet has the same number of input fields rows/col.
KSSV
KSSV on 24 Mar 2016
using xlsread you can read the sheet you want.

Sign in to comment.

Answers (1)

John BG
John BG on 24 Mar 2016
Kris
the page of a Microsoft Excel workbook can be directly addressed in the command xlsread:
filename='wrkbk1.xlsx'
read_sheet = 3
read_range = 'B2:C3'
[num,txt,raw]=xlsread(filename,read_sheet,read_range)
the extracted data is in num. Once whatever data in MATLAB you can process it with any operation you want, and once ready you can store it back in same or another Excel spread sheet with command xlswrite that has format
xlswrite(file,A,write_sheet,write_range)
If you find this answer of any help solving your question, please click on the thumbs-up vote link,
thanks in advance
John
  3 Comments
John BG
John BG on 26 Mar 2016
for instance, there is an excel file called ShipData.xlsx that looks like this:
When reading with
[num,txt,raw]=xlsread('ShipData.xlsx','ShipData','A1:B10')
you get the following
num =
9180401.00
9376036.00
9354868.00
9573000.00
9179397.00
9293545.00
9707792.00
8972194.00
9148142.00
txt =
'Register Number' 'IMO Number'
'12536D' ''
'14968W' ''
'16283B' ''
'15126T' ''
'06466F' ''
'04893V' ''
'22394T' ''
'962G60' ''
'39Y697' ''
raw =
'Register Number' 'IMO Number'
'12536D' [9180401.00]
'14968W' [9376036.00]
'16283B' [9354868.00]
'15126T' [9573000.00]
'06466F' [9179397.00]
'04893V' [9293545.00]
'22394T' [9707792.00]
'962G60' [8972194.00]
'39Y697' [9148142.00]
the file name can be the same or a different file, it's up to you.
Hope it helps.
Regarding your design reasoning, i rather not go through it until you have a script that, working or crashing, is a concise start point for another question or comment.
John
Kris Lawson
Kris Lawson on 26 Mar 2016
Ok. Thank you very much for clearing that up for me.
I will post again when I have some code underway.

Sign in to comment.

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!