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.
0 件のコメント
採用された回答
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.
0 件のコメント
その他の回答 (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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Whos についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!