Path: news.mathworks.com!newsfeed-00.mathworks.com!nlpi057.nbdc.sbc.com!prodigy.net!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!j20g2000vbp.googlegroups.com!not-for-mail
From: ImageAnalyst <imageanalyst@mailinator.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Help needed with indexing to the first occurrence of a value
Date: Wed, 3 Jun 2009 19:58:51 -0700 (PDT)
Organization: http://groups.google.com
Lines: 34
Message-ID: <8da3ca2b-7ac7-4b07-aca0-4be73de0a7d7@j20g2000vbp.googlegroups.com>
References: <h079fp$166$1@fred.mathworks.com> <h07b65$jv8$1@fred.mathworks.com> 
	<h07c1f$dve$1@fred.mathworks.com>
NNTP-Posting-Host: 75.186.70.56
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1244084332 19907 127.0.0.1 (4 Jun 2009 02:58:52 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 4 Jun 2009 02:58:52 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: j20g2000vbp.googlegroups.com; posting-host=75.186.70.56; 
	posting-account=0rLUzAkAAABojYSRC64DkTbtiSCX77HH
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; 
	GTB6; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 
	3.5.21022),gzip(gfe),gzip(gfe)
Bytes: 2397
Xref: news.mathworks.com comp.soft-sys.matlab:544695


On Jun 3, 10:37 pm, "Jack "
<use.text.after.underscore.only_jcan...@csu.edu.au> wrote:
> Hi Sadik,
>
> Thanks for the reply... i tried your suggestion, however the returned variable is an empty matrix...?
>
> Jack
>
>
>
> "Sadik " <sadik.h...@gmail.com> wrote in message <h07b65$jv...@fred.mathworks.com>...
> > You could say
>
> > firstIndex = find(F==98,1);
>
> > "Jack " <use.text.after.underscore.only_jcan...@csu.edu.au> wrote in message <h079fp$16...@fred.mathworks.com>...
> > > I have a single column vector "F". How can I index to the first occurrence of a the value "98". Only the row at which "98" first occurs is needed (... yes, I am a newbie to matlab). I am having trouble correctly using the find and index functions... Any help would be greatly appreciated. Thanks- Hide quoted text -
>
> - Show quoted text -

------------------------------------------------------------------------------
Then 98 isn't in your array.  Try this:
clc;
close all;
F = randperm(150)
firstIndex = find(F==98,1)