How to "call" a function

For my matlab class, we have to "call" a function. However, the video that was shown to us only shows how to call functions within functions. Let's say if I have a function that calls several other functions (these functions find the max, min, average, etc. of an array), and I have to call that function into another script that has an array, how would I do that?

回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 1 月 16 日

0 投票

There is no difference in calling a function if you are in a script or in a function. You still use the same syntax
[first_output, second_output, third_output etc] = function_name(first_parameter, second_parameter, third_parameter etc)

2 件のコメント

Kyle Donk
Kyle Donk 2020 年 1 月 16 日
what do you mean by "first parameter", "second parameter", etc.?
Walter Roberson
Walter Roberson 2020 年 1 月 16 日
first_parameter is the parameter that you pass in the first position after the ( after the function name. second_parameter is the parameter that you pass in the second position after the ( after the function name.
Basic parameter passing is all positional in MATLAB unless the function iset set up to handle name/value pairs.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeGet Started with MATLAB についてさらに検索

質問済み:

2020 年 1 月 16 日

コメント済み:

2020 年 1 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by