Given are two matrices (a & b). I want to end the For-loop if all values in the matrix (a minus b) are smaller than 7, in contrast to any value in the matrix (a minus b) is smaller than 7. Can anybody help me with this problem?
For[Q = 0, Q <= 20, Q += 1,
Print[Q];
Print[a = {{40, 40, 40}, {40, 40, 40}, {40, 40, 40}}];
Print[b = Q {{4, 4, 4}, {4, 3, 4}, {4, 4, 4}}];
compare[matrix_, length_, width_, value_] :=
Module[{state}, state = False; For[i = 1, i <= length, i++,
For[j = 1, j <= width, j++,
If[matrix[[i, j]] < value, state = True]]]; Return[state]];
If[compare[a - b, 3, 3, 7], Break[],]];
Max[a - b] < 7
$\endgroup$