MATLAB: How can convert binary Numerical Values to Strings

binaryMATLABmatrix arraystrings

let's say I Have a Matrix M which contains only binary values of 0 and 1
M = de2bi (0:10)
How can I convert that into a Matrix which is comprised of Strings (e.g. 'black' & 'white', or 'zero' & 'one') instead of the 0's and 1's ?
0 1 0 1
0 0 0 1
0 1 0 0
1 0 0 1
to
black white black white
black black black white
black white black black
white black black white

Best Answer

How about
ca = cell(size(yourMatrix)); % Preallocate cell array
for k = 1 : numel(ca)
if yourMatrix(k)
ca{k} = 'white '; % yourMatrix is 1
else
ca{k} = 'black '; % yourMatrix is 0
end
end