Meaning of the following: function [y1,...yn] = input()
이전 댓글 표시
I have inherited a script that is used in an application that has something like in the title. I and in my journey to understand everything it does I came across a function without outputs and an empyt set of inputs. What is the meaning syntax wise of the emtpy ()?
function [e,eSheets, N,all,membrane_curve,orifice_curve,correctedloss,design_flow,diffperori,units,elevation_tolerance,epsilon,pausetime,...
equivalent_length,active_area,diameter,absolute_roughness,temp,depth,header,correction_factor,bypassed]=input()
I can't find any reasonable answers online on what the meaning of an empty set of parentheses are.
채택된 답변
추가 답변 (1개)
Ameer Hamza
2020년 4월 14일
편집: Ameer Hamza
2020년 4월 14일
Empty parenthesis means that the function does not need any input. Such functions are quite similar to scripts except that they have their own workspace: https://www.mathworks.com/help/matlab/matlab_prog/base-and-function-workspaces.html
There can be several reason why a function does not need any input. For example, you want to write a function to print the current date and also return it as a character array. Such a function will not need any input from the user.
function currentDate = showDate()
currentDate = date;
disp(currentDate);
end
It is also possible for function to not have any input and output. For example,
function showDate()
disp(date);
end
Why your function does not have any input will depend on the purpose for which it was written.
카테고리
도움말 센터 및 File Exchange에서 Simulink 3D Animation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!