How can i fix this?

1 次查看(过去 30 天)
Pablo Manuel Torres Hernandez
Hi, im working on App designer ,I´ve alreday run my code and there were no problem until i put another object(button) on my app layout.
This extra object(Button) were no necessary for my code at least , so i deleted. When i try runnig my code after that, it was no able to show me my app . And this error pops up:
Error using Control_Piston
Error: File: Control_Piston.mlapp Line: 38 Column: 9
Function definitions are not permitted in this context
there´s no code in that function and a i can´t delete it. Do you know how can i fix that?
  2 个评论
Geoff Hayes
Geoff Hayes 2021-12-17
@Pablo Manuel Torres Hernandez - you may need to attach your mlapp file so that we can see what the code looks like.
Image Analyst
Image Analyst 2021-12-17
Pablo, you may have deleted a function line, deleted an "end" line, or put some line of code in between the end of one function and the beginning of another. Like @Geoff Hayes said, we'd need to see the code to know for sure.

请先登录,再进行评论。

回答(1 个)

prabhat kumar sharma
Hi Pablo,
I understand that you are facing issue with your application after deleting the callback function for the button.
To delete the callback function I'll suggest Within App Designer, you can right click the callback under the 'Callback tab' within the 'Code Browser', which is on the left side panel. See screenshot below.
Please ensure the function is deleted successfully from the code view.
Inspect the context: Check to see if there is a function definition that is not inside a methods block. The methods block should look something like this:
methods (Access = private)
function result = myFunction(app, arg1, arg2)
% Function code here
end
end
Sometimes, accidental insertion of text or characters can cause MATLAB to interpret it as a function definition. Ensure there are no unintended characters in the code.
I hope it helps!

类别

Help CenterFile Exchange 中查找有关 Dialog Boxes 的更多信息

标签

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by