MATLAB: Problem with cells and lines cells Hi! in an array we have this command: a is an array % code a(1:5:end)=[] end ho could i do this for cells? Best Answer a={'1' '2' '3' '4' '5' '6'}a(1:3:6)=[] Related SolutionsMATLAB: Cell array to vector using cell2mat Some alternatives:V = cell2mat(C);V = [C{:}];V = horzcat(C{:});V = cat(2,C{:});Each of these can be adapted different for different situations, so it is useful to know similar (but different) way of achieving this. MATLAB: Accessing cell array data every 2 columns and concatenating them Easy with cellfun:%generate random data:A=cell(3,6);x=[137 134 410 411 439 455];for r=1:size(A,1) for c=1:size(A,2) A{r,c}=num2cell(randi(10,1,x(c))); endend%the actual line of code:A=cellfun(@(x1,x2) [x1,x2],A(:,1:2:end),A(:,2:2:end),'UniformOutput',0); Related QuestionHow to multiply data from cellsProblem with “Intersect” functionCellfun not working for cells contain cellsHow to construct a cell array from another cell arrayOmitting data from a cell arrayRemoving elements from a cell array
Best Answer