function handle specify in matlabfcn function

조회 수: 2 (최근 30일)
llu
llu 2021년 11월 14일
댓글: llu 2021년 11월 22일
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