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: Sat, 28 May 2011 03:36:05 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 62 Message-ID: <irpqj5$7k0$1@newscl01ah.mathworks.com> References: <iroop9$bvf$1@newscl01ah.mathworks.com> <iror0g$ie3$1@newscl01ah.mathworks.com> Reply-To: <HIDDEN> NNTP-Posting-Host: www-01-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: newscl01ah.mathworks.com 1306553765 7808 172.30.248.46 (28 May 2011 03:36:05 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Sat, 28 May 2011 03:36:05 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1636294 Xref: news.mathworks.com comp.soft-sys.matlab:729119 Hello, Thanks for the help! However, in my case, I can not know which column I want. I can only know the index number [1;2;3] or [4;5;6]. The first three numbers in one column are actually coordinates. Therefore, I hope to find the data (e.g., 44) when I enter the coordinates (e.g., [1;2;3]). Or, I hope to find the data (e.g., 44 and 74) when I enter the coordinates (e.g., [1;2;3] and [4;5;6]. Sorry that I did not make myself clearer. Thanks! Yihui "someone" wrote in message <iror0g$ie3$1@newscl01ah.mathworks.com>... > "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