Hi Rebecca,
I think it would be easiest just to loop through all of the elements of the matrix. To access a given element in the cell array 'bins', use the curly braces {}, in a way that you similarly would use parentheses () for matrices.
For the first part:
output = cell(size(bins));
for k=1:length(bins),
mat = bins{k};
mat(:,5)=[];
output{k} = mat;
end
The second part of your request is unclear. Once you break each row into four separate groups of three columns, what do you want to do with the data? Are you assigning each group as an element of the cell array (such that the final cell array is 255x4)? If so, this revised code will work:
output = cell(length(bins), 4);
for k=1:length(bins),
mat = bins{k};
mat(:,5)=[];
output{k,1} = mat(:,[1 2 3]);
output{k,2} = mat(:,[1 2 4]);
output{k,3) = mat(:,[1 3 4]);
output{k,4} = mat(:,[2 3 4]);
end
Best Answer