undefined function in GUI
이전 댓글 표시
Hello, can i ask why when i write code for GUI, it show
Undefined function 'multiply' for input arguments of type 'double'.?
Thank you.
댓글 수: 4
Joseph Cheng
2021년 6월 15일
it might be more helpful to show the line of code which this specifically specifies. are you using a function multiply?
Lim Xiao Hui
2021년 6월 15일
Geoff Hayes
2021년 6월 15일
Lim - is multiply a function that you have written because I can't find it in the MATLAB documentation? If it is a custom function (either yours or perhaps from the File Exchange) then the error message is possibly telling you that the function cannot be found along the MATLAB search path. Or you are trying to call a function that doesn't exist anywhere.
Lim Xiao Hui
2021년 6월 15일
답변 (1개)
Kishan Dhakan
2021년 6월 16일
0 개 추천
If you're using MATLAB app designer, it will be easier if you click the 'add a function' button and define your multiply there itself (I see no reason to do it in a separate script). Note: If you add it as a private method, use app.multiply() everywhere.
댓글 수: 3
Rik
2021년 6월 16일
There are many reasons to define your custom functions in a separate file. One of those is that you might have written a function that does a specific task, and you want to do that in your app AND somewhere else.
Can you image the nightmare it would be if I had to remember every place I used a function like my readfile function in case I have an update for it?
You should only put functions only inside the app if they are actually specific to that app.
Kishan Dhakan
2021년 6월 16일
편집: Kishan Dhakan
2021년 6월 16일
Rik, accepted. I meant I see no reason for this 'multiply' specifically. As '*' would do the multiplication in general anywhere, I assumed this function is specific to the app.
Rik
2021년 6월 16일
Given that you only know the name, it would be a bit odd to assume the functionality is the exact same as *.
Maybe this is what that function does:
function af=multiply(x,y)
af=@(c) x*y + c;
end
카테고리
도움말 센터 및 File Exchange에서 Manage Products에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
