By far the best solution is to avoid representing numeric values as categorical values in the first place. If you can un-do that, that's the best solution.
If that cannot be done, here's how to convert categorical values that contain numeric values in a table.
Table T can contain mixed classes (some classes may cause errors).
This demo detects which columns of T contains values that can be converted to numers. It then creates an output table T_converted that contains the num-categorical-number columns of T and the categorical-number columns converted to numbers.
T = table(["A";"B";"C";"D";"E"],categorical(randi(10,5,1)),categorical(randi(10,5,1)),categorical(randi(10,5,1)));
Tmat = cellfun(@double,table2cell(T));
isnum = all(~isnan(Tmat),1);
Tnum = array2table(Tmat(:,isnum),'VariableNames', T.Properties.VariableNames(isnum), 'RowNames', T.Properties.RowNames);
T_converted = [T(:,~isnum), Tnum];
Best Answer