matlab - Pick the values from the corresponding max matrix -


i don't think asked question right, example make easier understand mean.

lets have 2 matrices

a = [5,5; 7,7]; b = [2,2; 6,4]; 

and 2 matrices, each 1 correspond 1 of above. lets say

a' = [7,7; 9,9]; b' = [1,1; 10,5]; 

and need construct new matrix, check each pixel in a' , b', pick max, goes corresponding matrix , extract value there.

in example newmat

newmat = [5,5; 6,7]; 

it easy done loops, there way out using loops ? in advance!

you can create logical matrix of aprime more bprime , can used grab values either a or b

aprime_is_greater = aprime > bprime;  % initialize c b , replace values aprime greater c = b; c(aprime_is_greater) = a(aprime_is_greater); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -