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.
Show older comments
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 Comment
Ahmed Mukhtar
on 12 May 2021
Accepted Answer
More Answers (1)
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 Comments
Ahmed Mukhtar
on 12 May 2021
Ahmed Mukhtar
on 12 May 2021
Jan
on 13 May 2021
There are two lines, which define the same function:
function ApplyNoiseButtonPushed(app, evt) % First
function ApplyNoiseButtonPushed(app, ~) % Twice
Simply omit the 2nd one.
Categories
Find more on Develop Apps Using App Designer 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!