Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: determine col num from column headers
Date: Thu, 14 Aug 2008 13:32:10 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 26
Message-ID: <g81c4q$nud$1@fred.mathworks.com>
References: <g7q2bb$ffi$1@fred.mathworks.com> <g7rj59$g4m$1@fred.mathworks.com> <g7sq09$rj2$1@fred.mathworks.com> <g7u46a$83j$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1218720730 24525 172.30.248.35 (14 Aug 2008 13:32:10 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 14 Aug 2008 13:32:10 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1413393
Xref: news.mathworks.com comp.soft-sys.matlab:485461



Fantastic! Thanks very much!

Kinda Regards,
Keli

> [..]
> 
> So your colheaders variable is a cell array of strings. 
> Then I'd expect a non-empty element somewhere in the 
> resulting cell array of strfind. 
> Besides, use find(strcmp( rather than strfind( on the 
cell 
> array. Perhaps you have to care about some extra 
whitespace 
> around your column names.
> The following example works:
> 
>     colheaders = {' Freq','  Torque ','Temp '};
>     cleanColheaders = strtrim(colheaders);
>     idx = find(strcmp('Torque',cleanColheaders));
>     % idx = 2
> 
> Check if you need to use strcmpi instead of strcmp.
> Does this work for you as well? If not, can you find out 
> why?