Wednesday 15 August 2012

excel - How to get MATLAB xlsread to read until a last row of a contiguous <>? -



excel - How to get MATLAB xlsread to read until a last row of a contiguous <<data-range>>? -

i want utilize xlsread in matlab read excel file.

while know columns want read from, , row want start reading from, file contain number of rows.

is there way like:

array = xlsread( 'filename', 'd4:f*end*' ); %% or similar syntax

where f*end* lastly row in column f?

yes. seek this:

fileformat = '.xls' or '.xlsx'; % take 1 % ( default matlab % imports '.xls' ) filename = strcat( 'filename desire', fileformat ); array = xlsread( filename ) % read % matrix ( default % matlab import % numerical info % file syntax )

then can size of matrix refine search/import.

[nrows,ncols] = size( array );

then if matrix want import parts of matrix, can this:

newarray = xlsread( filename, strcat( 'initial cell', ':', 'columnletter', num2str( nrows ) ) ); % case: newarray = xlsread( filename, strcat( 'd3', ':', 'f', num2str( nrows ) ) );

hope helps.

excel matlab

No comments:

Post a Comment