MATLAB: Trying to use logical matrix to get remove some elements from matrix instead of getting a same matrix im getting a column matrixlogical operations on matrixa=[1,2,3;12,21,2;2,1,2]b=(a>1)c=a(b)im getting resultb = 0 1 1 1 1 1 1 0 1c = 12 2 2 21 3 2 2>> i want c matrix to be 3*3 matrix but im getting it as column matrix Best AnswerTry this:a=[1,2,3;12,21,2;2,1,2]c = a .* double(a > 1)
Best Answer