How can I import an excel workbook's SHEET TITLE?

조회 수: 4(최근 30일)
Coral Reyes
Coral Reyes 2015년 6월 22일
편집: VBBV 2021년 10월 25일
I am writing a program by importing data from an excel workbook and the final result is a figure for each sheet. I am using a for loop to generate all the figures and will like to use each sheet's name as the figure's title and file name. Is there a way I can connect both?

답변(2개)

Jeremy
Jeremy 2015년 6월 22일
use the xlsfinfo function to read the names of all the sheets in an excel file.
  댓글 수: 1
Coral Reyes
Coral Reyes 2015년 6월 22일
So let's say I have 4 sheets and I have my figures i write
for kk=1:1:4
x=xlsread('Excel Title.xlsx', kk, 'A2:A11'); Y=xlsread('Excel Title.xlsx', kk, 'B2:B11');
hold on;
for ii=1:1:10
plot (x(ii),y(ii))
end
title('xlsinfo')?
end
how do I use that function? I am new to Matlab

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


VBBV
VBBV 2021년 10월 25일
편집: VBBV 2021년 10월 25일
for kk=1:1:4
x=xlsread('Excel Title.xlsx', kk, 'A2:A11');
y=xlsread('Excel Title.xlsx', kk, 'B2:B11');
sheets = sheetnames('Excel Title.xlsx') % use sheetnames
{sheets}
plot(x,y)
title(sheets{kk})
hold on;
end
Try using sheetnames as its recommnded by Matlab

Community Treasure Hunt

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

Start Hunting!

Translated by