How can i fix this?

1 回表示 (過去 30 日間)
Pablo Manuel Torres Hernandez
Pablo Manuel Torres Hernandez 2021 年 12 月 14 日
回答済み: prabhat kumar sharma 2024 年 1 月 16 日
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
prabhat kumar sharma 2024 年 1 月 16 日
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 Center および File ExchangeDialog Boxes についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by