# plz help how can use go to in MATLAB

조회 수: 18(최근 30일)
eman baky 2021년 7월 30일
편집: eman baky 2021년 8월 24일
i wrote this code
Truth_Taple_mapping = {'T' '0' '0' 'G' '0' '0' 'G'}
dna_stego={'ATG' 'TCG' 'ATC' 'TTC' 'ACC' 'CCC' 'ACC' 'AAC' 'CAG' 'ACC'}
count=1;
for m=1:numel(Truth_Taple_mapping)
if (Truth_Taple_mapping{m}~=0)
num=get_codon(dna_stego{count}); % n1
if(num==1)
temp=dna_stego{count};
temp(3)=Truth_Taple_mapping{m};
dna_stego{count}=temp ;
else
count=count+1;
% goto n1
end
end
where
Truth_Taple_mapping = {'T' '0' '0' 'G' '0' '0' 'G'},dna_stego={'ATG' 'TCG' 'ATC' 'TTC' 'ACC' 'CCC' 'ACC' 'AAC' 'CAG' 'ACC'}
TCG,TCC,ACC,CCC that can be change
i try to replace the third char in each cell in dna_stego with Truth_Taple_mapping if not equal zero and dna_stego can be changed
TCG,TCC,ACC,CCC and i used get_codon function to determiate that return 1 if it can be change and 0 if not
the output must be { 'ATG' 'TCT' 'ATC' 'TTC' 'ACG' 'CCC' 'ACC' 'AAC' 'CAG' 'ACG'}
and try but i cant do it
##### 댓글 수: 4표시숨기기 이전 댓글 수: 3
Rik 2021년 7월 30일
@eman baky Please don't flag other questions if you're just asking for help. Flags are to attract the attention of site admins.

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

### 답변(2개)

Walter Roberson 2021년 7월 30일
MATLAB itself does not have a GO TO, and never will.
Simulink diagrams sort of have a GO TO but it does not affect flow of control and is instead just a way to be able to name a signal and bring the signal to an arbitrary point by name.
I believe that Simscape diagrams can have GO TO.
However, I do not see anywhere in the code where a GO TO would be used even if GO TO existed??
##### 댓글 수: 5표시숨기기 이전 댓글 수: 4
eman baky 2021년 8월 24일
Thank you, sir

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

DGM 2021년 7월 30일
I'm going to guess that the nonzero content of the "truth taple mapping" vector is supposed to correspond to the locations where the prefix of dna_stego matches amino_acid, in other words elements 2,5, and 10. If that's the case, it's not the right length, and the elements aren't even in the right locations.
The last sequence in dna_stego can't be changed, given the existing description of intended behavior. Either it's wrong or amino_acid is missing AT. I am going to choose to change it to ACC.
% this is probably unnecessarily fragile due to the required index
% correspondence, but i don't know the meaning of these operations
TTmap = {'0' 'T' '0' '0' 'G' '0' '0' '0' '0' 'G'};
dna_stego={'ATG' 'TCG' 'ATC' 'TTC' 'ACC' 'CCC' 'ACC' 'AAC' 'CAG' 'ACC'};
amino_acid={'CG' 'GG' 'TC' 'CC' 'AC' 'GC' 'CT' 'GT'};
% this works so long as all sequences are the same length
dna_stego_out = vertcat(dna_stego{:});
ttnonzero = ~strcmp(TTmap,'0').';
aamatches = ismember(dna_stego_out(:,1:2),amino_acid);
dna_stego_out(ttnonzero & aamatches,3) = [TTmap{ttnonzero}];
dna_stego_out = num2cell(dna_stego_out,2).'
dna_stego_out = 1×10 cell array
{'ATG'} {'TCT'} {'ATC'} {'TTC'} {'ACG'} {'CCC'} {'ACC'} {'AAC'} {'CAG'} {'ACG'}
My suspicion is that TTmap is something that's supposed to be calculated in-process, otherwise its very existence implies that you already know exactly which sequences in TTmap are going to be changed. If that's already been determined, why are we doing it again?
##### 댓글 수: 5표시숨기기 이전 댓글 수: 4
eman baky 2021년 8월 24일
There is no relationship between them. This is part of the code hiding data in DNA TTmap is sequence includes data and I wanna put them in dna_stego but under condition
if 0 I will change not
if not equal 0 I will check dna_stego if will change or not if allowed I will change the third char with TTmap
for checking dna_stego I used function return 0 if not and 1 if allowed
but here I wrote what can change by compare dna_stego with amino_acid if dna_stego second and third character is a member in amino_acid it allowed
amino_acid={'CG' 'GG' 'TC' 'CC' 'AC' 'GC' 'CT' 'GT'};

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

### Community Treasure Hunt

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

Start Hunting!

Translated by