Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: repost problem of find function due to the misaligned text Date: Fri, 27 May 2011 18:37:04 +0000 (UTC) Organization: The Mitre Corp Lines: 51 Message-ID: <iror0g$ie3$1@newscl01ah.mathworks.com> References: <iroop9$bvf$1@newscl01ah.mathworks.com> Reply-To: <HIDDEN> NNTP-Posting-Host: www-03-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: newscl01ah.mathworks.com 1306521424 18883 172.30.248.48 (27 May 2011 18:37:04 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Fri, 27 May 2011 18:37:04 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 2318 Xref: news.mathworks.com comp.soft-sys.matlab:729067 "Yihui" wrote in message <iroop9$bvf$1@newscl01ah.mathworks.com>... > Dear Matlab experts, > > I have a problem with “find” function. > Assuming that I have a 4 x 3 data as follows: > 1 4 7 > 2 5 8 > 3 6 9 > 44 74 12 > > I would like to selectively output certain number by entering the numbers in the first three rows. For instance, I enter > 1 4 > 2 3 > 3 6 > > and then i can get > 1 4 > 2 5 > 3 6 > 44 74 > as output. > > Could you please tell me how to do this? Thanks for any suggestions in advance. > Sincerely, > Yihui > > % Its hard to determine exactly what you are trying do do. % From your example, why not simply: >> A = [1 4 7; 2 5 8; 3 6 9; 44 74 12] A = 1 4 7 2 5 8 3 6 9 44 74 12 >> B = A(:,1:2) B = 1 4 2 5 3 6 44 74