xlsread certain range of rows
7 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
dpb
2017-3-21
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 个评论
dpb
2017-3-21
"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
2017-3-21
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import from MATLAB 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!