Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: How to Select Entire Row From Excel File Uisng Prompt?
Replies: 11   Last Post: Nov 23, 2012 5:52 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Phil Goddard

Posts: 351
Registered: 1/27/12
Re: How to Select Entire Row From Excel File Uisng Prompt?
Posted: Nov 18, 2012 1:22 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

You could spend time digging into the file to see how many columns of the specified row are actually used and then just extract those cells, but it may be just as quick to use a sledge hammer approach

try
% Reading 2007 and 2010 files
row = xlsread('myfile.xls',sprintf('A%d:XFD%d',rowNumber));
catch ME %#ok
try
% read 2003 files
row = xlsread('myfile.xls',sprintf('A%d:IV%d',rowNumber));
catch ME
rethrow(ME);
end
end

% Strip nans from the result
% (This will strip all nans not just those at the end of the row.)
data = row(~isnan(row));

Phil.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.