xlsread selection of the lines

조회 수: 1 (최근 30일)
franco otaola
franco otaola 2016년 10월 18일
댓글: dpb 2016년 10월 18일
hello everybody. i was wondering if it’s possible to use in the xlsread in matlab to indicate the initial value to export till and that the matlab itself recognize where to end. for better explain myself i have a table that another program creates from measures in the time. and the table begins in the A11:B5010 (for example) and what i am using right now is this command:
data = xlsread(files(i).name,'A11:B5010')
but sometimes the experience takes more time than the measures i have so for example the table would finish at B6000. that’s why i would like to make something like
data = xlsread(files(i).name,'A11:Bend')
is there any possibility to make this in a way that the program itself adapts to the length of the table? so i can treat different measures at the same time that has different time periods?

채택된 답변

dpb
dpb 2016년 10월 18일
Just read the sheet. xlsread will return the numeric data in an array of the size it is. If there's data prior to the initial row that's not wanted, then just eliminate it in memory.
  댓글 수: 2
franco otaola
franco otaola 2016년 10월 18일
thanks i make what you said,its works, the only problem is that in that way it stocks a lot more of information and of what i need and because i work with a lot of excels it takes alot more of time....
dpb
dpb 2016년 10월 18일
It actually takes measurably longer to read a full sheet than the subset? That surprises me immensely. What's the range of actual data and content?
xlsread only understands range expressions that are two opposing corners and doesn't have any dynamic features such as the end function that refers to the last element in an in-memory array, say.
It can use a named range if you can define that in the spreadsheet to encompass the area of interest. To use that syntax you must also specify the sheet name explicitly. See documentation for details.
I'm sure there's probably a function within Excel via ActiveX server to ascertain the location of last element but that's getting into what is an Excel facility question, not Matlab; see the Excel help files for how one would do that (I don't know Excel more than rudimentary and every time I've looked at the functional programming in same it's been so overwhelming in its volume and difficulty in finding what one's looking for I've always just given it up instead. I know there are those who are whizzes; just not me, sorry).

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by