Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
How to call a function
조회 수: 3 (최근 30일)
이전 댓글 표시
I have a function which is written according to the following table, Somehow the function is wrong,Please help me in correcting it.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/149562/image.png)
I had written the following code but it is not able to execute the function properly. Please help. Thanks in advance.
function [C] = XORS(A,B)
A = cell2mat(A);
B = cell2mat(B);
C(A == 'A' & B == 'A') = 'A';
C(A == 'A' & B == 'T') = 'T';
C(A == 'A' & B == 'C') = 'C';
C(A == 'A' & B == 'G') = 'G';
C(A == 'T' & B == 'A') = 'T';
C(A == 'T' & B == 'T') = 'A';
C(A == 'T' & B == 'C') = 'G';
C(A == 'T' & B == 'G') = 'C';
C(A == 'C' & B == 'A') = 'C';
C(A == 'C' & B == 'T') = 'G';
C(A == 'C' & B == 'C') = 'A';
C(A == 'C' & B == 'G') = 'T';
C(A == 'G' & B == 'A') = 'G';
C(A == 'G' & B == 'T') = 'C';
C(A == 'G' & B == 'C') = 'T';
C(A == 'G' & B == 'G') = 'A';
댓글 수: 0
답변 (1개)
Titus Edelhofer
2015년 4월 28일
Hi,
hmm, if you call it correctly, it seems to work?
C = XORS({'A' 'C'}, {'A' 'G'})
C =
AT
You might add a num2cell at the end of the function to convert back to cell array, if you like ...
Titus
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!