anyway to call matlab function without bracket

4 ビュー (過去 30 日間)
Yu Li
Yu Li 2019 年 11 月 11 日
コメント済み: Yu Li 2019 年 11 月 11 日
Hi:
the usual Matlab function need to be called like: function(input), but I noticed that some function such as 'save', can be used like: save a a
so my question is, is there anyway to call a Matlab function like: function input
Thanks!
Yu

採用された回答

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH 2019 年 11 月 11 日
yes it is possible, but you cannot assign the result to a variable, I leave you an example:
function c=sumexample(a,b)
if ischar(a)
a=str2double(a);
end
if ischar(b)
b=str2double(b);
end
c=a+b;
this function can be called in both ways:
sumexample 4 5
and
sumexample(4,5)
  1 件のコメント
Yu Li
Yu Li 2019 年 11 月 11 日
thank you, it works.
Yu

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by