xlsread selection of the lines

3 vues (au cours des 30 derniers jours)
franco otaola
franco otaola le 18 Oct 2016
Commenté : dpb le 18 Oct 2016
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?

Réponse acceptée

dpb
dpb le 18 Oct 2016
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 commentaires
franco otaola
franco otaola le 18 Oct 2016
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 le 18 Oct 2016
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).

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by