Hello,
I have 2 matrices, a & b, both 1024×1024. I am trying to create an "if/else" statement where each element in the same position in the two matrices are compared to each other. Depending on which value is greater, the subsequent analysis is performed. I have the following code, but it is currently running with "any" value in the matrix. Is there a way to do if/else on an elemental basis? I then want to find the average of all the resulting values (here, average of "ab" and "ba.") Is there a better way to do this than my current methods? This is what I have so far (and thanks for your help!):
a = load('0.txt');b = load('9.txt');if any(a > b) ab = (a-b)./(a+(2*b)); abavg= mean(mean(ab,'omitnan'), 'omitnan') abSD= std2(ab);else ba = (b-a)./(b+(2*a)); baavg= mean(mean(ba,'omitnan'), 'omitnan') baSD= std2(ba);end
Best Answer