Functions and Global Variables
显示 更早的评论
This is my code. (Edited)
function B = PBTask4P2b_f(COUNTER)
B = input('TRUCK B: ');
while COUNTER < 1000
B = B + COUNTER;
if COUNTER > 1000
COUNTER = 0;
fprintf('Counter has been reset to 0.\n')
else
fprintf('COUNTER = %f.\n',B);
end
end
end
4 个评论
Yash Shil Balgobin
2021-4-3
编辑:Yash Shil Balgobin
2021-4-3
dpb
2021-4-3
The assignment doesn't ask for the user to input data within either task function...
Yash Shil Balgobin
2021-4-3
dpb
2021-4-3
The example usage of your functions in the problem statement shows it being passed as an argument to the two functions, doesn't it?
Your way, there's no need for an argument variable.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Variables 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
