Keeping track of numbers randomly generated

조회 수: 2 (최근 30일)
Sumara
Sumara 2019년 6월 12일
편집: Sumara 2019년 6월 12일
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
madhan ravi
madhan ravi 2019년 6월 12일
Upload the missing datas also the tables as .mat file.
Sumara
Sumara 2019년 6월 12일
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

댓글을 달려면 로그인하십시오.

채택된 답변

Sumara
Sumara 2019년 6월 12일
편집: Sumara 2019년 6월 12일
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)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by