Meaning of the following: function [y1,...yn] = input()

1 次查看(过去 30 天)
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.

采纳的回答

Jim Riggs
Jim Riggs 2020-4-14
编辑:Jim Riggs 2020-4-14
It simply means that there are no user inputs to this function. The long list of variable names are returned from the function.
One can infer that the function most likely returns a-priori constants, or reads an input file and returns the values, or a combination of both.

更多回答(1 个)

Ameer Hamza
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.

类别

Help CenterFile Exchange 中查找有关 Whos 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by