From: ImageAnalyst on 11 Jun 2010 22:12 Still clear as mud. So MatrixC is a 1000 x 36 2-dimensional array (of 36,000 elements total), and C=[1:36] is a one dimensional array that looks like [1,2,3,4,5,......34,35,36]. Then we have "MtrixC" which I guess is that same as MatrixC (just a typo). Plus we have MatrixA, MatrixB, A, and finally B. But MatrixB is certain columns from C, so MatrixB must also be a 2D array. But C is only a 1-D array (row vector) so it's columns are only element high, so I guess that means MatrixB is actually also a 1D row vector. I gave up at this point.
From: Roger Stafford on 11 Jun 2010 22:36 Luna Moon <lunamoonmoon(a)gmail.com> wrote in message <8bd25c7a-3b59-4b8f-b6a1-8eb1ebbec132(a)a1g2000vbl.googlegroups.com>... > ........ > Here is an example: > Originally the data matrix MatrixC is 1000 x 36, so C=[1:36]. > B=[1, 3, 5, 7, 9:36]; so there are 32 numbers in B, they are all > referenced w.r.t. C. > So I have the data matrix MatrixB, consisting of the [1, 3, 5, 7, > 9:36] columns from the original data matrix C. > However, due to costs of measurements, I don't have MatrixC, I have > only measured MatrixB. > I also have A=[1, 5, 9, 11, 13, 25, 31, 33, 34, 35, 36], all the > numbers of which are again referenced w.r.t C. > And A is B's subset. > I would like to obtain > MatrixA=MatrixC(:, A) ideally speaking. > However I don't have MtrixC, I only have MatrixB. > So how do I obtain MatrixA from MatrixB and the index sets A, B, C > without "for" loops? > ....... - - - - - - - Does this do what you want? I too had trouble understanding your question. [ignore,p] = ismember(A,B); matrixA = matrixB(:,B(p)); Roger Stafford
From: Steven Lord on 14 Jun 2010 11:36 "Luna Moon" <lunamoonmoon(a)gmail.com> wrote in message news:8bd25c7a-3b59-4b8f-b6a1-8eb1ebbec132(a)a1g2000vbl.googlegroups.com... On Jun 11, 6:20 pm, "Patrick " <praph...(a)gmail.com> wrote: > Hmm, your post is a bit confusing. Could you give a small example? The example you posted is still too large and general to understand, I think. Let's try this. Run the next four lines of code to generate four variables (saving any existing variables with those names first, if you don't want them to be overwritten) C = 1:4; MatrixC = reshape(1:20, 5 4); B = [2 5 3]; MatrixB = MatrixC(:, B); Now show us how to generate a SMALL sample A and a small sample MatrixA and use those six variables to explain EXACTLY what you want to receive in the end and how you want to compute it. If one of the sample variables I've given does not satisfy the requirements of your problem, explain why not and show us how to explicitly create a sample variable that does. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
From: Roger Stafford on 14 Jun 2010 16:02 "Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <huurqj$jtj$1(a)fred.mathworks.com>... > Does this do what you want? I too had trouble understanding your question. > > [ignore,p] = ismember(A,B); > matrixA = matrixB(:,B(p)); > > Roger Stafford - - - - - - I made a mistake on that code I sent. It should have read: [ignore,p] = ismember(A,B); matrixA = matrixB(:,p); Roger Stafford
First
|
Prev
|
Pages: 1 2 Prev: problem with fsolve Next: Assigning different values to a variable in every loop |