MATLAB: Comparing values of two matrix

compare matrix valuesmatrix values

Hi lets say I have 2 matrices A=[1 2 1 2 3 3], B=[1 2 2 1 3 3], i want to compare values of matrix and write in different matrix C, if same "s", if not same "n". result should be C=['s' 's' 'n' 'n' 's' 's'], thanks !!

Best Answer

c0 = {'n','s'};
C = c0( 1+(A == B));