I'm working on a Matlab program that creates 2 n*n matrices, where n and each of the terms of the matrix (these will just be 0 or 1) are keyboard input values. The idea is that at the end the positions i,j in which the terms of the matrix are 1 are printed.
For example, if the inputs of matrix A are:
array = [];
array2 = [];
arrayb = [];
arrayb2 = [];
for m = 1: n
for n = 1: n
if A(m,n)==1;
array = [array, m];
array2 = [array2, n];
end
if B(m,n)==1;
arrayb = [arrayb, m];
arrayb2 = [arrayb2, n];
end
end
end
fprintf(array,array2)
The output should be
(1,1) = 1
(1,2) = 1
(2,1) = 0
(2,2) = 1
I have only been able to extract each of the term indices separately
{(1,1) ,(1,2), (2,2)}