From: Simon Buckley on 22 Jun 2010 05:11 I am looking to find a way to solve the following problem, any advice would be most appreciated: I have a total of 3 matrices of the same dimensions (3000x2865) in my workspace- m1 m2 m3. m1 and m2 are matrices containing a range of values from 0-100 and m3 is a matrix which contains values 0 or 1. I would like to generate a new matrix of the same dimensions which takes values from m1 and m2 according to the value in m3. For example where m3=0 the value from m1 is taken and where m3=1 the value from m2 is taken.
From: Oleg Komarov on 22 Jun 2010 05:43 "Simon Buckley" <s.f.buckley(a)dur.ac.uk> wrote in message <hvpuna$3a7$1(a)fred.mathworks.com>... > I am looking to find a way to solve the following problem, any advice would be most appreciated: > I have a total of 3 matrices of the same dimensions (3000x2865) in my workspace- m1 m2 m3. > m1 and m2 are matrices containing a range of values from 0-100 and m3 is a matrix which contains values 0 or 1. I would like to generate a new matrix of the same dimensions which takes values from m1 and m2 according to the value in m3. For example where m3=0 the value from m1 is taken and where m3=1 the value from m2 is taken. m4 = nan(size(m1)); m4(m3 == 0) = m1(m3 == 0); m4(m3 == 1) = m2(m3 == 1); look for logical indexing Oleg
|
Pages: 1 Prev: modify duplicate column data Next: matrix for dwt transformation |