I have an arry of data called 'D' that has this size n-by-100. In first row of the data there is a specific vector that shows type of each column. Number of 1 to 10 was assigned to distinguish these types. I am going to generate these 10 different submatrices {d1,d2...., and d10} from original data ('D'), wherein d1 collects all type-1 and d2 accomodates all type-2, and so on. How can I creat these submatrics and after doing some functions return them to their original format.
Thanks,
Frank
Here's a way using loops:
for itype=1:10
cols{itype}=D(1,:) == itype; % remember this for later
d{itype}=D(:,cols{itype});
end
Later, to put all the pieces together again
D1=D; % Allocate storage
for itype=1:10
D1(:,cols{itype})=d{itype};
end