MATLAB: How to generate random purmutation of string matrix

randomstrings

I would like to have binary mask matrix of sub-block matrices of 1s and 0s that are random inside the big matrix . The way i am trying to do it is to modify the matlab checkerboard function.
I would like to have random permutation of
tile = [white black; white black]
so that the checherboard matlab function is somewhat random each time when it is called
The code bellow does not work.
n = 10;
black = zeros(n);
white = ones(n);
tile = ([black white; white black ]);
P = perms(tile);
a = randi([1 24],1);
tile = P(a,:);

Best Answer

n = 2
black = zeros(n)
white = ones(n)
tile = {black white; white black }
idx = randperm(4)
tile=cell2mat(reshape(tile(idx),2,2))