Using costant value to Anonymous function

11 ビュー (過去 30 日間)
ELISABETTA COCCIA
ELISABETTA COCCIA 2019 年 10 月 24 日
回答済み: Sahithi Kanumarlapudi 2019 年 10 月 30 日
How can I write an anonymous function calling back a costant value?

回答 (1 件)

Sahithi Kanumarlapudi
Sahithi Kanumarlapudi 2019 年 10 月 30 日
Assuming by calling back a constant value’ you mean that the anonymous function returns a constant value the following code is an example
s = @(x) 5; % anonymous function
Now if you run
a(23)
Output is
5
Hope this helps!

Community Treasure Hunt

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

Start Hunting!