One approach with unique, few diff's and combinations of any, all -
%// Tag each cell element based on their uniqueness among other cells
[~,~,idx] = unique(a)
ar = reshape(idx,size(a))
%// Perform checks along columns, rows, diagonals and anti-diagonals
col_check = any(all(diff(ar,[],1)==0,1))
row_check = any(all(diff(ar,[],2)==0,2))
diag_check = all(diff(ar(eye(3)==1))==0)
antidiag_check = all(diff(ar(fliplr(eye(3))==1))==0)
%// Finally check if any of the checks are true for the final output
out = col_check | row_check | diag_check | antidiag_check
Sample run -
a =
'x' '' 'o' 'o'
'' 'o' 'o' 'o'
'o' 'o' 'o' 'x'
'o' 'o' 'o' 'o'
col_check =
1
row_check =
1
diag_check =
0
antidiag_check =
0
out =
1