find

James Sherman Jr. shermanj at umd.edu
Thu Jun 4 11:15:01 CDT 2009


If you really need have it done in one line, I'd just write a function to do
what you're doing in two lines.  Or are you worried about find taking too
long?

On Thu, Jun 4, 2009 at 11:26 AM, Carlo Rossi <serosole at yahoo.it> wrote:

>
> Hello,
>
>
> class = [1  1 1 -1 -1 1];
>
> This is is what I need:
>
> idx1 = find(class == 1); %retrieve the indexes of '1': 1,2,3,6
> idx2 = find(class == -1); % retrieve 4,5
>
> But I'd like to know if it's possible write it in a hit (and I need 2
> different variables, id2, idx2)
>
> [idx1, idx2] = find(class == 1;  class == -1) %this dosn't work.
>
> thanks,
>
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www-old.cae.wisc.edu/pipermail/help-octave/attachments/20090604/4a9b5f84/attachment.html 


More information about the Help-octave mailing list