xlsread certain range of rows
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I have a very large excel file. When I used xlsread command it took very long time to read entire range. Therefore, I want to read just a part of it.
Column: Same as xlsread.
Row: 1:10000.
When I tried, xlsread(File,sheet,'1:1000'), it read all columns of 10645(?). However, I want to read the range of columns that xlsread loads automatically. I just want to cut off certain range of rows. Deleting rows after loading whole data is not an option because it took too much time.
Thank you.
0 commentaires
Réponse acceptée
dpb
le 21 Mar 2017
You can enter any rectangular range argument to xlsread in Excel A1:X200 syntax. You must, however, know the ranges of interest this way. Or, create a named area in the spreadsheet that comprises the area of interest. It must also be contiguous, hence rectangular.
3 commentaires
dpb
le 21 Mar 2017
"How" is more an Excel question than Matlab; xlsread is an m-file that does only a bunch of input verification/error-checking then calls the actual worker-functions that are either .mex or .m program files (hence source not viewable) that do all the hard work. Here's the list for R2014b; none of these m-files are human-readable to see just what they actually do.
> C:\ML_R2014b\mcr...ab\iofun\private> *dir xlsread*.*
...
Directory of C:\ML_R2014b\mcr\toolbox\matlab\iofun\private\xlsread*.*
8/29/14 15:25 1,109 xlsreadBasic.m
8/29/14 15:25 1,274 xlsreadCOM.m
8/29/14 15:25 1,244 xlsreadSplitNumericAndText.m
8/05/14 9:21 32,256 xlsreadStr2Dbl.mexw32
9/15/14 21:50 644 xlsreadStr2Dbl_mexw32.auth
8/29/14 15:25 944 xlsreadTrimArrays.m
8/29/14 15:25 3,629 xlsreadXLSX.m
>
XLSREAD is a black-box for the end-user community; if you want more abilities you'll have to resort to COM/Active-X yourself or write VBA code on the Excel side or such.
The better solution is probably to have the wanted data written to a file on the side creating the Excel file in a more readily-accessible form for input.
Stephen23
le 21 Mar 2017
The best solution would be to avoid using a propriety format like excel, and store the data in a file that is designed for storing and transferring data.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Import from MATLAB dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!