Write a function taking three variables as input and returning the minimum of them. i've tried doing this-
5 次查看(过去 30 天)
显示 更早的评论
a = input ('enter a >');
b = input ('enter b >');
c = input ('enter c >');
A = [a, b, c];
B = min(A);
disp(B)
however this seems so simple is there any way you can create a user defined function in which you can input 3 values and receive the minimum as an output??
0 个评论
回答(1 个)
Steven Lord
2021-10-25
See this section of the documentation for instructions on how to create a function with input and output arguments in a file.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!