MATLAB: Converting categorical array to cell array

categorical arraysdatatype conversion

Hi all, I am trying to convert a categorical array to a cell array so that I can use the strrep function, but i cant seem to find anyway to do it after scouring the web to the best of my abilities. My categorical column contains string that have the '_' character and i want to search the column and replace any string that has '_' with '-'. Is there any way I can do it without converting the datatype? Any help would be greatly appreciated. Thank you

Best Answer

a=nominal({'R_','G_','B_'});
b=cellstr(a);
c=strrep(b,'_','-');
d=nominal(c)
d =
R- G- B-