Given a 3x3 matrix, check each of the columns starting from the first one, and if a column contains 1 or -1 the output is x, otherwise the output is y. Then list the sequence of these x,y as a vector. For example, let A={{2,1,1},{0,1,0},{0,0,1}}, then f is the vector where f(1)=y, f(2)=x, f(3)=x, according to the given matrix
I tried the following but it needs to be revised:
For[k = 1, k <= 3, k++, For[z = 1, z <= 3, z++, If[A[[z, k]] == 1 || A[[z, k]] == -1, f[[k]] = y, f[[k]] = x; ]; ]; ]; f[[1]], f[[2]], f[[3]]
I also tried this one but in this version if a column has 1 then output is x otherwise the output is y
For[k = 1, k <= 3, k++, If [A[[1, k]] == 1 || A[[2, k]] == 1 || A[[3, k]] == 1, f[[k]] = y, f[[k]] = x; ]; ];