Why [] appears after a function?

1 回表示 (過去 30 日間)
Carolina Silva
Carolina Silva 2019 年 11 月 28 日
編集済み: Stephen23 2019 年 11 月 28 日
What does this means?

採用された回答

Stephen23
Stephen23 2019 年 11 月 28 日
編集済み: Stephen23 2019 年 11 月 28 日
According to the function documentation, those square brackets contain any output arguments. Because the square brackets you show in your question contain zero variables, that function has zero output arguments.
function [A,B,C,D] = myfun(...) % 4 output arguments
function [A,B,C] = myfun(...) % 3 output arguments
function [A,B] = myfun(...) % 2 output arguments
function [A] = myfun(...) % 1 output arguments
function [] = myfun(...) % 0 output arguments
For one or zero output arguments the square brackets can be omiited entirely:
function A = myfun(...) % 1 output arguments
function myfun(...) % 0 output arguments

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by