matlab - How to distinguish the two picture matrices? -


i have picture matrix a, size of 200*3000 double. , have picture matrix b, size of 200*1000 double. 1000 columns of matrix b comes columns of matrix a. question is:

how matrix c same size of matrix a, keep original values of columns in matrix b? mean size of matrix c 200*3000 double, 1000 columns have same values matrix b. other 2000 columns set value d, second question, value should set d, picture matrix c can distinguish picture matrix a?

use ismember 'rows' option. here's example:

a = [1 2 3 4; 5 6 7 8]; %// example b = [3 10 1; 7 20 5];   %// example b val = nan;              %// example value indicate no match  c = a; %// initiallize ind = ismember(a.',b.','rows'); %// matching columns c(:,~ind) = val; %// set non-matching columns val 

equivalently, coud replace ismember bsxfun, line becomes

ind = any(all(bsxfun(@eq, a, permute(b, [1 3 2])), 1), 3); 

in example,

a =      1     2     3     4      5     6     7     8 b =      3    10     1      7    20     5 c =      1   nan     3   nan      5   nan     7   nan 

Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -