function index=findStrIndex(strarray,str); %% =========================================================================== %findStrIndex - Find string (index) in array of strings % % Parameter: strarray Array of strings % Parameter: str String to find % Returns: index Index of string (1 if not found) % % Example(s): % i=findStrIndex(MenuArray,'Exit'); % % Algorithmic details: % % Reference: % %% =========================================================================== %% =========================================================================== % Copyright (C): % 1999 by Telia Research AB, Lulea, Sweden; % 2000-2003 by Forschungszentrum Telekommunikation Wien, Austria; % All rights reserved. % Project : FTW's xDSLsimu % Author(s) : Tomas Nordstrom (Tomas.Nordstrom@FTW.at) % : Daniel Bengtsson (Daniel.J.Bengtsson@Telia.se) % % CVS: $Id: findStrIndex.m,v 3.1 2002/12/27 15:37:34 tono Exp $ %% =========================================================================== % Change History % 1999-01-11 (ToNo) Created %% =========================================================================== index=1; for i=1:length(strarray(:,1)), if strcmp(deblank(strarray(i,:)),str) index=i; break; end end