reading from excel by page

조회 수: 3 (최근 30일)
Kris Lawson
Kris Lawson 2016년 3월 23일
댓글: Kris Lawson 2016년 3월 26일
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
Kris Lawson
Kris Lawson 2016년 3월 24일
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 2016년 3월 24일
using xlsread you can read the sheet you want.

댓글을 달려면 로그인하십시오.

답변 (1개)

John BG
John BG 2016년 3월 24일
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
John BG
John BG 2016년 3월 26일
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 2016년 3월 26일
Ok. Thank you very much for clearing that up for me.
I will post again when I have some code underway.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by