How to use the @ function calling when the function is defined as a variable?

1 次查看(过去 30 天)
Hello,
I tried the following
Myfunction='runf'
[x,y,z]=@Myfunction
where runf id the real function
It did not work. Is this possible at all?
Thank you

采纳的回答

Chunru
Chunru 2022-8-30
MyfunctionStr='rand'; %'runf'
Myfunction = str2func(MyfunctionStr);
%[x,y,z]=@Myfunction
x = Myfunction()
x = 0.7439
  4 个评论

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by