From: Alois S. <alo...@tu...> - 2006-01-03 09:49:58
|
illiam Poetra Yoga Hadisoeseno wrote: >On 1/2/06, Alois Schloegl <alo...@tu...> wrote: > > >>William Poetra Yoga Hadisoeseno wrote: >> >>Concering the additional support of cellstrings, I suggest to changes as >>attached. Moreover, the result in >> IDX = strfind(STR,PATTERN) should return a vector, not a cell with an >>vector element. The attached version does this. >> >> >> > >Actually, my version returns a vector. > Ok. I see, you need an extra "if" and a flag variable. >It works by 'generalizing' the >input, like this: >1. If the first arg is a string or char matrix, then put it into a >cell array and take note of this. >2. Now the object we have is a cellstr (otherwise an error would be >generated). For every element in the cellstr, check for PATTERN and >put the starting indexes in IDX. >3. If the first arg was a string or char matrix, then take the vector >inside IDX and assign it to IDX. >This way, we can avoid recursion of strfind(). What do you think? > > I prefer the recursive version. It gives cleaner and shorter code and needs less temporary variables. >>I'll check in the changes into Octave-forge. You can post it to >>bug-octave and ask John to include it. >> >> >> source-octave (instead of bug-octave) would be more appropriate. > >OK :) > >I fixed the help message and changed isstr to ischar in my version >(attached). What do you think about it? > > I changed isstr to ischar, too. >-- >William Poetra Yoga Hadisoeseno > > Best, Alois |