Suppressing Functions Without Removing Output
이전 댓글 표시
Hello,
I am new to matlab and I have been having this problem:
-Say for example I have this function,
function [circle_area] = calcarea(r)
%calculates the area of a circle given radius length
circle_area = pi.*(r.^2)
end
- This displays out the output circle_area and also the "ans"
- I want to suppress the "ans: but without removing the output [cicle_area]
- If I delte [circle_area] I am affecting all my scripts where I use this function
- Example Script affected by deleting output:-
% This script calculates the area of a circle
% It prompts the user for the radius
radius = input('Please enter the radius: ');
% It then calls our function to calculate the
% area and then prints the result
area = calcarea(radius);
disp('The area is ');
disp(area);
- This displays an error too many outputs which I concluded came from the missing output when I delete [circle_area]
Can someone help me with this, it would be much appreciated.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!