reading from excel by page

3 Ansichten (letzte 30 Tage)
Kris Lawson
Kris Lawson am 23 Mär. 2016
Kommentiert: Kris Lawson am 26 Mär. 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 Kommentare
Kris Lawson
Kris Lawson am 24 Mär. 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 am 24 Mär. 2016
using xlsread you can read the sheet you want.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

John BG
John BG am 24 Mär. 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 Kommentare
John BG
John BG am 26 Mär. 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 am 26 Mär. 2016
Ok. Thank you very much for clearing that up for me.
I will post again when I have some code underway.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Data Import from MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by