Path: news.mathworks.com!newsfeed-00.mathworks.com!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!news-2.dfn.de!news.dfn.de!feeder.erje.net!eternal-september.org!.POSTED!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: isolating a column based in a matrix
Date: Thu, 08 Jul 2010 07:39:50 -0500
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <i14h3i$hk7$1@news.eternal-september.org>
References: <i14c5h$b73$1@fred.mathworks.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 8 Jul 2010 12:42:27 +0000 (UTC)
Injection-Info: mx02.eternal-september.org; posting-host="J1AkDJ0iQilmVEl3PCI0oQ";
	logging-data="18055"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+QLQlEMTNOfY/utJgt2Bzw"
User-Agent: Thunderbird 2.0.0.24 (Windows/20100228)
In-Reply-To: <HIDDEN>
Cancel-Lock: sha1:fTMCur/cuYvuMNsnCJnFqrYwobs=
Xref: news.mathworks.com comp.soft-sys.matlab:651378

Ulrik Nash wrote:
> Hi Everyone,
> 
> Suppose I have a matrix
> A = [1 3 4 6; 10 9 30 23]
> 
> now I wish to perform an operation, so that I create
> 
> B = [3 9]
> 
> Note that B contains the column of A where the second row value is 
> smallest.
> 
> How is this done?

[dum,idx]=min(A(2,:)); B=A(:,idx);

--