Hey, this is my code and it doesnt work if I try to get something in the 3rd or 4th quadrant. Can someone tell me where my mistake is?
function [ romannum ] = quadrant( x,y )
if x>0, y>0
fprintf('Input coordinates will be in quadrant I. \n')
elseif x<0,y>0
fprintf('Input coordinates will be in quadrant II. \n')
elseif x<0,y<0
fprintf('Input coordinates will be in quadrant III. \n')
elseif x>0, y<0
fprintf('Input coordinates will be in quadrant IV. \n')
end
end

 채택된 답변

the cyclist
the cyclist 2014년 10월 26일

1 개 추천

This syntax
if x>0, y>0
is wrong. It should be
if x>0 & y>0
assuming you mean "and".

댓글 수: 1

David Phung
David Phung 2014년 10월 26일
Thank you so much! I cant believe I overlooked that.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Performance and Memory에 대해 자세히 알아보기

질문:

2014년 10월 26일

댓글:

2014년 10월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by