Initial commit
[pftoolbox.git] / findcstr.m
bloba8856dfda2c4961e9738ae867681dad8e03d87fe
1 function index=findcstr(carray,str)\r
2 % Searches for a given string in a cell array of strings.\r
3 %\r
4 % Syntax: (* = optional)\r
5 %\r
6 % index = findcstr(carray,str);\r
7 %\r
8 % In arguments:\r
9 %\r
10 % 1. carray\r
11 %       A cell array of strings\r
12 % 2. str\r
13 %       The string to search for.\r
14 %\r
15 % Out arguments:\r
16 %\r
17 % 1. index\r
18 %       The element number (in the cell array) of the first occurance.\r
19 %       index=0 means that the given string was not found.\r
20 %\r
21 % Used by the get/set functions, and will become private after the final\r
22 % version is created.\r
24 % Toolbox for nonlinear filtering.\r
25 % Copyright (C) 2005  Jakob Rosén <jakob.rosen@gmail.com>\r
26 %\r
27 % This program is free software; you can redistribute it and/or\r
28 % modify it under the terms of the GNU General Public License\r
29 % as published by the Free Software Foundation; either version 2\r
30 % of the License, or (at your option) any later version.\r
31 %\r
32 % This program is distributed in the hope that it will be useful,\r
33 % but WITHOUT ANY WARRANTY; without even the implied warranty of\r
34 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
35 % GNU General Public License for more details.\r
36 %\r
37 % You should have received a copy of the GNU General Public License\r
38 % along with this program; if not, write to the Free Software\r
39 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\r
41 for i=1:length(carray)\r
42         if strcmp(carray{i},str)\r
43                 index=i;\r
44                 return;\r
45         end\r
46 end\r
47 index=0;\r