How can i fix this?
1 view (last 30 days)
Show older comments
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 Comments
Geoff Hayes
on 17 Dec 2021
@Pablo Manuel Torres Hernandez - you may need to attach your mlapp file so that we can see what the code looks like.
Image Analyst
on 17 Dec 2021
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.
Answers (1)
prabhat kumar sharma
on 16 Jan 2024
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!
0 Comments
See Also
Categories
Find more on Dialog Boxes in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!