How to solve "Parse error at METHODS: usage might be invalid MATLAB syntax."? (MATLAB 2017b)

11 visualizzazioni (ultimi 30 giorni)
Good day all.
I have an issue on running an application in App Designer as when I tried to simulate the designed app, the error occured:
Error using DRS
Error: File: DRS.mlapp Line: 94 Column: 5
Illegal use of reserved keyword "methods".
And when I put cursor on methods and it shows:
"Parse error at METHODS: usage might be invalid MATLAB syntax"
This problem occured when I tried to link the selections in drop-down menu to another three panels that have connection between it.
The code that I used is shown below:
% Value changed function: DropDown
function DropDownValueChanged(app, event)
value = app.DropDown.Value;
% Hide all the panels
app.PanelA.Visible = 'off';
app.PanelB.Visible = 'off';
app.PanelC.Visible = 'off';
%If Panel A is selected, show panel 1
if strcmp(value,'Panel A')
app.PanelA.Visible = 'on';
elseif strcmp(value,'Panel B')
app.PanelB.Visible = 'on';
elseif strcmp(value,'Panel C')
app.PanelC.Visible = 'on';
end
end
I have lost the direction, which part that I actually did wrong? May I ask the opinion from the community?
Thank you in advanced.

Risposta accettata

Harsha Priya Daggubati
Harsha Priya Daggubati il 7 Ago 2019
Hi,
The error might pop-up due to no matching end for the method block created by you in the App Designer Code. You also can’t create one method block inside another method block. I suggest you to search your code for any such cases.
Hope this helps!

Più risposte (1)

Li Mun Ng
Li Mun Ng il 20 Ago 2019
Dear Harsha,
Thank you for your solution and I found out that the parse error was due to the reason I did not put an "End" to close the loop. That's why it was unable to run the app. Thank you once again and I appreciate that.

Categorie

Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by