[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
"find" equivalent for strings?
From: |
Mike Miller |
Subject: |
"find" equivalent for strings? |
Date: |
Tue, 13 Sep 2005 14:19:58 -0500 (CDT) |
Simple example input file:
bob
joe
sally
bob
bob
reading in the data:
x=textread("file.txt","%s");
x =
{
[1,1] = bob
[1,2] = joe
[1,3] = sally
[1,4] = bob
[1,5] = bob
}
Now I want to determine which elements of x consist of "bob" (so I want
the vector [1,4,5] returned), but I'd rather not use a loop. Is there any
way to do this without doing strcmp on every element of the cell?
Mike
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- "find" equivalent for strings?,
Mike Miller <=