Make a graph with data from all sheets in excel

Every day I carry out a new experiment, each one corresponds to a seperate sheet on the same excel file. Is there a way of finding the data from each sheet to plot it all on one graph? Thanks

댓글 수: 4

In case anyone is interested, I worked out a way (although it's insanely inefficient as you shouldn't plot graphs inside loops but I couldn't find another way) I used: [~,sheets]=xlsfinfo('sheets.xlsx'); then used a for loop going between one and length(sheets), which I used to index the page number on xlsread and plot each graph, turning hold on, then ending so the next sheet can be plotted until the loop finishes.
dpb
dpb 2016년 7월 21일
So, if that's the way you're going to store the data, that's really your only choice unless there's Excel code that could be written using ActiveX/COM to retrieve multiple sheets in a single call. I suppose there is with extended addressing but that's an Excel syntax issue, not Matlab, and I'm not adept enough (and have no intention of becoming so :) ) to know how one would write it; that'd be a question for an Excel support forum not Answers.
Alternatively, don't use Excel but create a "real" file structure that can be read in its entirety instead and append to it when the new day's data are available.
noname
noname 2018년 3월 8일
It gave me an error if I used xlsfinfo. I want to read all the spreadsheet in the same excel file and plot each spreadsheet, not plot them in one graph. Can anyone give an example how to do it? Thanks alot.
dpb
dpb 2018년 3월 9일
Have to show the code that caused the error...post what you've tried and where ran into a problem.

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

 채택된 답변

dpb
dpb 2016년 7월 21일
편집: dpb 2016년 7월 21일

0 개 추천

Sure, just use xlsinfo to return the sheet names in the spreadsheet and iterate over that collection. See
doc xlsfinfo
doc xlsread % for details

댓글 수: 2

ah Thanks, I've just seen your answer, that seems similar to what I did (although I used xlsfinfo as opposed to xlsinfo), thanks!
dpb
dpb 2016년 7월 21일
"I used xlsfinfo as opposed to xlsinfo"
That was a typo, there is no xlsinfo

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

질문:

2016년 7월 21일

댓글:

dpb
2018년 3월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by