Info
此问题已关闭。 请重新打开它进行编辑或回答。
how to do it...
2 次查看(过去 30 天)
显示 更早的评论
I have an excel sheet.. it reads huge data eg: 1647 *20. I used load function to extract 1st & 5th column. But still i wann some function to restict it so that it reads the data from the corresponding column upto 10/certain limit but not all... Like 1 column is time: showing time from 1 till 162 secs.. similarly 5 th column showing pressure from some random data... I want to read 1st 10 time & 1st ten pressure data from my excel sheet.
0 个评论
回答(3 个)
Image Analyst
2013-11-6
That is not huge - far, far from it. You can pass in the range you want to read into xlsread(), so just pass in a smaller range. If you don't know the range until you've read it in, then read in a little bit more than you think you'd need and check. Otherwise you can use ActiveX to pull over one cell at a time and check it, but honestly I don't believe that will give you any noticeable speed up over just reading the whole thing in and checking it in MATLAB. Or you could read in the whole time column, then check it to see how many rows you need, then read in that many rows from column 5. If you did that, you should use ActiveX because it you used xlsread() to do that, it involves launching Excel twice and shutting it down twice, which is time consuming.
If you're interested, I've attached an ActiveX demo below.
0 个评论
David Sanchez
2013-11-6
Option 1:
my_data_time = xlsread('your_excell.xls','A1:A10'); % first column
my_data_pressure = xlsread('your_excell.xls','E1:E10'); % fifth column
Option 2:
all_data = xlsread('your_excell.xls');
my_data = all_data(1:10,[1,5]);
% you'll end up with a matrix whose first column is time and second column is pressure
2 个评论
ES
2013-11-7
Those are not headers.. 'A1:A10' is a cell range of 10 cells starting A1 to A10.
my_data_time = xlsread('your_excell.xls','A1:A10'); % first column
this particular line will read first 10 rows of the first column of your excel file. Excel file has this row information with it. These are not any typed headers or so.
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!