From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Compare Structure Entries
Date: Mon, 31 Dec 2012 08:18:11 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 13
Message-ID: <kbrho3$b08$>
References: <kbr33c$nvs$>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1356941891 11272 (31 Dec 2012 08:18:11 GMT)
NNTP-Posting-Date: Mon, 31 Dec 2012 08:18:11 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: comp.soft-sys.matlab:785671

"Zeph Davies" wrote in message <kbr33c$nvs$>...

> I know the solution:
> for i = 1:length(A)
> isequal(A(i),B)
> end
> But this uses a loop. Is it possible without a loop?

arrayfun(@(x) isequal(x,B), A) 

But intrinsically this solution is not better than the for-loop.