Function is not working
이전 댓글 표시
Can somebody please tell me why this is not working? I'm a beginner with Matlab
relor = gdif(target==2);
if relor > 90
coror = relor - 180;
elseif relor < -90
coror = relor + 180;
else
coror = relor;
end
댓글 수: 4
Walter Roberson
2020년 10월 8일
What error are you getting?
I note that you do not have a function header as would be required for a function.
MadjeKoe
2020년 10월 8일
Image Analyst
2020년 10월 8일
Then your coror must be in the range -90 to +90, inclusive. What is gdif and target? What values do they have???
Walter Roberson
2020년 10월 8일
I suspect that target == 2 is true for more than one location, so that relor is a vector instead of a scalar. If so then you need to use logical indexing.
채택된 답변
추가 답변 (1개)
Walter Roberson
2020년 10월 9일
relor = gdif(target==2);
coror = relor;
mask = relor > 90;
coror(mask) = relor(mask) - 180;
mask = relor < -90;
coror(mask) = relor(mask) + 180;
카테고리
도움말 센터 및 File Exchange에서 Performance and Memory에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!