MATLAB: String to Categorical array categorical array Hi I have an array of x=[zeros(1,120) ones(1,240)]; I want to convert it into a categorical array of 'Z' of size 1×120 and 'O' of size 1×240. How to do that.? Thanks in advance. Best Answer x = [zeros(1,120), ones(1,240)];res = categorical(x, [0, 1], {'Z', 'O'}); Related SolutionsMATLAB: How to count the 1X1 cells in a cell array a=cellfun(@numel,Out)sum(a==1) MATLAB: How to merge cell (100 x 3) of arrays into a single cell (100 x 1) by concatenating the arrays Where X is the input cell array of size N*3: cellfun(@(a,b,c)horzcat(a,b,c),X(:,1),X(:,2),X(:,3),'UniformOutput',false) Related QuestionConcatenate cell array into one stringHow to find a certain content with index in cell array by loopingHow to convert a matrix to a cell arrayShuffle the rows a matrix
Best Answer