MATLAB: When I switch a double variable to a cell array the dimensions are wrong

occurrence

I have a 4 by 4 double that I want to switch to a cell array, so i can search for the occurrence of a number.
lets A be the 4 by 4 double. using this line of code.
A_cell = cellstr(num2str(A));
I get a 4 by 1 cell array, by I want 4 by 4 cell array so I search through the numbers and find the occurrence. cheers.

Best Answer

A_cell = sprintfc('%g', A);
I do not understand how this will help you search for an occurrence of a number, though. If you want to search for a number, == or ismember() or ismembertol() is usually the better choice.