필터 지우기
필터 지우기

How do I fix the "A METHODS block or END might be missing before the function definition. This might be causing additional error messages." issue.

조회 수: 9 (최근 30일)
Hey, I'm new to the app designer in MATLAB and while trying to write a code for a button push callback I get the message A METHODS block or END might be missing before the function definition. This might be causing additional error messages. Here's a screenshot for reference:
  댓글 수: 1
Ahmed Mukhtar
Ahmed Mukhtar 2021년 5월 12일
Additional error info:
Error using app4
Error: File: app4.mlapp Line: 57 Column: 9
Function definition not supported in this context. Create functions in code file.

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2021년 5월 13일
It looks like you defined the function ApplyNoiseButtonPushed inside itself. No - you cannot do that. A function cannot have another function nested inside it that has the same name as the parent function. Either delete that line, or (if it really is a separate function) call it something else.

추가 답변 (1개)

Jan
Jan 2021년 5월 12일
편집: Jan 2021년 5월 12일
The conditions are not recognized in the "elseif" commands. If you really want to move them to the next line, insert the line continuation "..." . But it looks nicer, if you move the condition to the same line as the elseif.
  댓글 수: 3
Jan
Jan 2021년 5월 13일
There are two lines, which define the same function:
function ApplyNoiseButtonPushed(app, evt) % First
function ApplyNoiseButtonPushed(app, ~) % Twice
Simply omit the 2nd one.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by