Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: find same value
Date: Thu, 9 Jun 2011 18:25:05 +0000 (UTC)
Organization: Tadulako University
Lines: 37
Message-ID: <isr361$k4s$1@newscl01ah.mathworks.com>
References: <isp2hq$ot$1@newscl01ah.mathworks.com> <3bc3d24c-d131-41bd-a180-32f439c2f03f@l18g2000yql.googlegroups.com> <isqrpo$r95$1@newscl01ah.mathworks.com> <isqtkd$3em$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-00-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1307643905 20636 172.30.248.45 (9 Jun 2011 18:25:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 9 Jun 2011 18:25:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2228514
Xref: news.mathworks.com comp.soft-sys.matlab:731109

"Roger Stafford" wrote in message <isqtkd$3em$1@newscl01ah.mathworks.com>...
> "pink" wrote in message <isqrpo$r95$1@newscl01ah.mathworks.com>...
> > I just wanted to check the data (matrix) if the (:, 1) there is or is not the same value, if it will it will display the message "warndlg"
> - - - - - - - -
>   You didn't answer the question I asked about what you meant by "same".  Here are tests for either meaning:
> 
> 1.  If "same" refers only to contiguous elements:
> 
>  t = any(diff(A(:,1)==0));
> 
> 2.  If "same" refers to any pair of elements within the vector:
> 
>  t = any(diff(sort(A(:,1))==0));
> 
> Roger Stafford
soory roger, not work
I just wanted to check first column element
A=[1 34;
     2 33;
     2 45;
     3 32;
     4 65;
     4 99;
     5 11;
     1 33;
     6 22]
on A (:, 1) there are 3 number the same, then A = 1
A=[1 34;
     2 33;
     3 45;
     4 32;
     5 65;
     6 99;
     7 11;
     8 33;
     9 22]
on A (:, 1) there is not the same numbers, then A = 0