How do I remove the Ans from the result
조회 수: 5 (최근 30일)
이전 댓글 표시
I'm using If in my code, but every time the condition is passed on, an ans appears in the result.
if Alpha(1,1) == 1
disp('Ok')
else Alpha(1,1) == 0
disp("Not okay")
endif
if Alpha(1,2) == 1
disp("ok")
else Alpha(1,2) == 0
disp("Not Okay")
endif
댓글 수: 0
답변 (3개)
Sulaymon Eshkabilov
2023년 1월 15일
You'd need to use either display or fprintf not to have ans, e.g.:
%% fprintf
if Alpha(1,1) == 1
fprintf('Ok \n')
else Alpha(1,1) == 0
fprintf('Not okay \n')
end
%% display
if Alpha(1,2) == 1
display("ok")
else Alpha(1,2) == 0
display("Not Okay")
end
댓글 수: 1
Walter Roberson
2023년 1월 15일
Questions about a different programming language should be addressed to the appropriate support resources for that programming language. We cannot be expected to know or explain the behaviour of a project whose purpose for existence is to put Mathworks out of business. (Yes, seriously, that is the design goal for Octave. Read about the Free Software Foundation, which is a political movement not a technical movement.)
댓글 수: 3
참고 항목
카테고리
Help Center 및 File Exchange에서 Octave에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!