Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!a42g2000vbl.googlegroups.com!not-for-mail From: Luna Moon <lunamoonmoon@gmail.com> Newsgroups: comp.soft-sys.matlab Subject: How do you do this fast? Date: Fri, 11 Jun 2010 13:26:13 -0700 (PDT) Organization: http://groups.google.com Lines: 43 Message-ID: <33a67c34-769a-44db-95c4-1ff9f71dccd9@a42g2000vbl.googlegroups.com> NNTP-Posting-Host: 199.89.103.12 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1276287973 9035 127.0.0.1 (11 Jun 2010 20:26:13 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 11 Jun 2010 20:26:13 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: a42g2000vbl.googlegroups.com; posting-host=199.89.103.12; posting-account=CYtergoAAAAOD8k-T_NdzknPJOBXmt8x User-Agent: G2/1.0 X-HTTP-Via: 1.1 piinbcgw03 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/2010041205 Firefox/3.6.3ms1,gzip(gfe) Xref: news.mathworks.com comp.soft-sys.matlab:644265 Hi all, I have sets A, B, C, where C is the biggest set, A is the smallest, C>B>A, i.e. C contains B contains A. These are indices indeed. I have a matrix m x n matrix MatrixC, where C=[1:n]. I have created a matrix MatrixB, which is MatrixB=MatrixC(:, B). Now I want to obtain MatrixA, which is MatrixA=MatrixC(:, A). --------------------------- However, in reality, actually for cost reasons, I didn't measure all MatrixC, instead, I took measurements for MatrixB. So all I have now is MatrixB, and sets A, B, C. i.e. the indices A and B are "in C's language". i.e. the indices A and B are numbered according to their positions in C=[1:n]. So the question is: how do I obtain MatrixA from MatrixB and sets A, B, C? I currently use a "for" loop plus "find" etc. to do this job, are there any fast approach without using "for" and "find"? Mine is too slow... too stupid... Thank you!