function handle specify in matlabfcn function

4 次查看(过去 30 天)
Hi,
Is it possible to specify the function handle in matlabfcn function when using the spreadsheet link in Excel? when i try to do an integration with the syntax"=@matlabfcn("quadgk","@(x) x.^2",M3,M4)" in Excel, it returnd an error, and said the first input argument must be function handle, is there anyone can help me how to specify the function handle in matlabfcn function? Many thanks.

回答(1 个)

Jan
Jan 2021-11-14
编辑:Jan 2021-11-16
According to the documentation doc matlabfcn :
=matlabfcn("quadgk(@(x) x.^2)", M3, M4)
  7 个评论
Jan
Jan 2021-11-21
编辑:Jan 2021-11-21
I cannot test it by my own. What about:
matlabfcn("@(a,b) quadgk(@(x) x.^2,a, b)", L3, L4)
llu
llu 2021-11-22
Can't work. Currently, the only methodology that I find is using the user definded function, like below:
function y = ab(a,b)
f= @(x) x.^2;
y= quadgk(f,a,b);
end
then use the syntax " matlabfcn("ab",L3,L4)" in excel

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Data Import from MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by