From: Luna Moon on 11 Jun 2010 16:26 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!
From: EE Student on 11 Jun 2010 18:19 Luna Moon <lunamoonmoon(a)gmail.com> wrote in message <33a67c34-769a-44db-95c4-1ff9f71dccd9(a)a42g2000vbl.googlegroups.com>... > 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! Luna, I dont quite understand what you are trying to do, but what I gather is that you are trying to find the portion A in B and B in C right? Do you already know the contents of A, B, and C and you just need to find where they are relative to each other? If so, there may be a better way but I would do this as a template matching problem. Use normxcorr2 with A as the template for B, and B as the template for C. Or at least read the help file and examples on normxcorr2 and template matching and see if this is along the lines of what you are attempting to do, otherwise you may want to try and explain better and post the code you have written so far because its tough to follow what your goal is. Nick
From: Patrick on 11 Jun 2010 18:20 Hmm, your post is a bit confusing. Could you give a small example? Luna Moon <lunamoonmoon(a)gmail.com> wrote in message <33a67c34-769a- 44db-95c4-1ff9f71dccd9(a)a42g2000vbl.googlegroups.com>... > 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!
From: Luna Moon on 11 Jun 2010 20:48 On Jun 11, 6:19 pm, "EE Student " <n...(a)cec.wustl.edu> wrote: > Luna Moon <lunamoonm...(a)gmail.com> wrote in message <33a67c34-769a-44db-95c4-1ff9f71dc...(a)a42g2000vbl.googlegroups.com>... > > 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! > > Luna, > > I dont quite understand what you are trying to do, but what I gather is that you are trying to find the portion A in B and B in C right? Do you already know the contents of A, B, and C and you just need to find where they are relative to each other? If so, there may be a better way but I would do this as a template matching problem. Use normxcorr2 with A as the template for B, and B as the template for C. Or at least read the help file and examples on normxcorr2 and template matching and see if this is along the lines of what you are attempting to do, otherwise you may want to try and explain better and post the code you have written so far because its tough to follow what your goal is. > > Nick Thanks Nick. Sorry for not being clear. 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? Thank you
From: Luna Moon on 11 Jun 2010 20:49 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? > > Luna Moon <lunamoonm...(a)gmail.com> wrote in message <33a67c34-769a- > > 44db-95c4-1ff9f71dc...(a)a42g2000vbl.googlegroups.com>... > > > 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! Thanks Patrick. Sorry for not being clear. 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? Thank you
|
Next
|
Last
Pages: 1 2 Prev: problem with fsolve Next: Assigning different values to a variable in every loop |