I want to save the following for-loop results in a new matrix using Matlab, how can I do that or any other suggestions?
Where X is a 5467-by-513 matrix , id is a 143-by-1 vector and wkno is a 44-by-1 vector
for i=1:size(id,1);
    for j=1:size(wkno,1);
        tst= X(:,1)==id(i) & X(:,2)==wkno(j);
        M=mean(X(tst,:));
    end
end
 
     
     
    