samedi 22 septembre 2018

MATLAB — How to eliminate equal matrices that are created randomly inside loop?

The code segment I'm working on is given below:

 NphaseSteps = 6;
 phases = exp( 2*pi*1i * (0:(NphaseSteps-1))/NphaseSteps );
 i = 1;
 while i <= 10  %number of iterations
     ind = randi([1 NphaseSteps],10,10);
     inField{i} = phases(ind);
     save('inField.mat', 'inField')
     i = i + 1;
 end

Now, what I want is to keep track of these randomly created matrices "inField{i}" and eliminate the ones that are equal to each other. I know that I can use "if" condition but since I'm new to programming I don't know how to use it more efficiently so that it doesn't take too much time. So, I need your help for a fast working program that does the job. Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire