MATLAB Answers

Why [] appears after a function?

7 views (last 30 days)
What does this means?

  0 Comments

Sign in to comment.

Accepted Answer

Stephen Cobeldick
Stephen Cobeldick on 28 Nov 2019
Edited: Stephen Cobeldick on 28 Nov 2019
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 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Tags