MATLAB: Is it possible to allow the UNIQUE function to support mixed data type cell arrays in MATLAB 7.7 (R2008b)

MATLABmixeduniquevalues

The UNIQUE function cannot search over cell arrays which contain elements that are not of type string. The following example illustrates this behavior.
C={'abc' 'abc' 4};
unique(C)
??? Error using ==> cell.unique
Input must be a cell array of strings.

Best Answer

The ability to use the UNIQUE function with cell arrays of mixed data types is not available in MATLAB 7.7 (R2008b).
As a workaround, use the CELLFUN command to convert all the elements in the cell array to strings before using the UNIQUE command to retrieve just the unique elements:
A={'abc' 'abc' 4};
Astr=cellfun(@(x)num2str(x), A,'UniformOutput',false)
unique(Astr)
If you have a multidimensional cell array with numeric values in certain columns, and you wish to retrieve unique rows of the cell array, please use the Resolution Document below called 'mixedcellunique.m' as follows:
% Creates an example cell array B
B = cell(5,4);
B{1,1} = 'Henrietta';
B{1,2} = 12;
B{1,3} = 100;
B{1,4} = 'Cherries';
B{2,1} = 'Violet';
B{2,2} = 23;
B{2,3} = 140;
B{2,4} = 'Marshmallows';
B(3,:) = B(1,:);
B(4,:) = B(1,:);
B(5,:) = B(2,:);
% Pulls out just the unique rows of B.
uniqueB = mixedcellunique(B)