MATLAB: Keeping track of numbers randomly generated

forloopMATLAB

This is the beginning of a for loop that determines the time the 'Binding_tRNA' adds in a set of given circumstances.
I'd like to output a table that keeps track of the Binding_tRNA numbers generated and whether they are Cognate, Near_Cognate, or Non_Cognate
for k = 1:maxIterations
Binder = rand;
Low = Binder<=Weight_Range;
Binding_tRNA = Fluitt1{end-(sum(Low)-1),'tRNA_'}
Cognate = sum(Binding_tRNA == Cognate_tRNAs);
Near_Cognate = sum(Binding_tRNA ==Near_Cognate_tRNAs);
Non_Cognate = sum(Binding_tRNA == Non_Cognate_tRNAs);
A = zeros((Cog_Attempts+Near_Cog_Attempts+Non_Cog_Attempts),2)
Sorry, I know it's not pretty I'm very new to coding

Best Answer

Hey all, nevermind, i figured it out, I was being dumb!!!
A=zeros(maxIterations,7);
for k = 1:maxIterations
Binder = rand;
Low = Binder<=Weight_Range;
Binding_tRNA = Fluitt1{end-(sum(Low)-1),'tRNA_'};
Cognate = sum(Binding_tRNA == Cognate_tRNAs);
Near_Cognate = sum(Binding_tRNA ==Near_Cognate_tRNAs);
Non_Cognate = sum(Binding_tRNA == Non_Cognate_tRNAs);
A(k,1:4) = [Binding_tRNA Cognate Near_Cognate Non_Cognate];
(I reference the other 3 variables in A in nested loops below this for loop)