Keeping track of numbers randomly generated

2 visualizzazioni (ultimi 30 giorni)
Sumara
Sumara il 12 Giu 2019
Modificato: Sumara il 12 Giu 2019
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
  2 Commenti
madhan ravi
madhan ravi il 12 Giu 2019
Upload the missing datas also the tables as .mat file.
Sumara
Sumara il 12 Giu 2019
I think this covers it?
Fluitt2_Cognate_Array = table2array(Fluitt2(:,2:5));
Fluitt2_NC_Array = table2array(Fluitt2(:,[2,6:end]));
Fluitt_NC = Fluitt2_NC_Array(:,2:end);
Cog_and_NC = [Fluitt2_Cognate_Array(:,2:end),Fluitt_NC];
Cog_and_NC2 = array2table(Cog_and_NC);
NonC_tRNAs = rowfun(@(varargin) setdiff(1:48, cell2mat(varargin)), Cog_and_NC2, 'OutputFormat', 'cell');
Codon = randi([0,64]);
Cognate_tRNAs = Fluitt2_Cognate_Array(Codon,2:end);
Near_Cognate_tRNAs = Fluitt2_NC_Array(Codon,2:end);
Non_Cognate_tRNAs = NonC_tRNAs{Codon,:};
Weight_Range = Fluitt1{1:end,'WeightRange'};
Num = 1;
maxIterations = 5;
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);
end

Accedi per commentare.

Risposta accettata

Sumara
Sumara il 12 Giu 2019
Modificato: Sumara il 12 Giu 2019
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)

Più risposte (0)

Tag

Prodotti


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by