Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!p73g2000hsd.googlegroups.com!not-for-mail
From: Ross <fed.rossi@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: sub-min
Date: Tue, 19 Feb 2008 08:25:54 -0800 (PST)
Organization: http://groups.google.com
Lines: 38
Message-ID: <d42e1709-c4a7-4675-b7f9-3c5098a4eff5@p73g2000hsd.googlegroups.com>
References: <3d8a1aea-b86f-4987-aea9-0c2420ee73e5@i29g2000prf.googlegroups.com> 
NNTP-Posting-Host: 165.124.164.96
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Trace: posting.google.com 1203438355 10660 127.0.0.1 (19 Feb 2008 16:25:55 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 19 Feb 2008 16:25:55 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: p73g2000hsd.googlegroups.com; posting-host=165.124.164.96; 
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.4) 
Xref: news.mathworks.com comp.soft-sys.matlab:452413


On Feb 19, 1:58 am, "Jos " <DEL...@jasenDEL.nl> wrote:
> Ross <fed.ro...@gmail.com> wrote in message
>
> <b21b9772-12c9-4842-a58e-34c1fc28f...@v3g2000hsc.googlegroups.com>...
>
>
>
> > On Feb 18, 7:43 pm, Ross <fed.ro...@gmail.com> wrote:
> > > Hi everyone,
>
> > > I have two 2-dim arrays, A and C. C is zeros and ones.
> > > I and want to find min(A, [ ] , 2), but only considering
> elements that
> > > are ones in matrix C.
>
> > > Do you know a fast way to compute this in matlab?
>
> > > Thank you!
> > > Ross
>
> > ok, I guess I will go with the brute force:
>
> > a = max(max(A));
> > Ca = C.*a;
> > Amin = min(Ca+A,[ ],2);
>
> B = A ; % work on a copy
> B(C==0) = Inf ;
> Amin = min(B,[],2)
>
> hth
> Jos

Hi Jos,
thank you for your message
I tried this method too, and I saw that matlab spends a lot of time
with this code. Maybe it is because the A matrix is huge or it is
sparse