0

I am designer an application using MATLAB App Designer. The very first panel is the home page panel which has a drop-down to allow the user to choose which age category and proceed to the set of questions that fits their age. So, I have created another 3 panels to link with the age category. The code for callback between drop down and others panels 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 1 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

However, problem occurred when I was trying to simulate the application. I got this error message: 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"

The following is the code that went wrong, the very first line got an error as mentioned before.

    methods (Access = private)
    % App initialization and construction
    methods (Access = private)

    % Create UIFigure and components
    function createComponents(app)

What should I do to rectify the problem? Thank you in advanced.

2
  • Could you at least show the code where you use methods? I don’t see it in the code you posted. Please read minimal reproducible example. Commented Aug 5, 2019 at 1:47
  • Thank you Cris for responding to my question. I actually solved the issue by just adding an "end" to the function and the issue was no longer ocurred. I am not sure whether it was the correct way of doing it but however it helped me to get the issue done.and I shall remove the question now. Commented Aug 6, 2019 at 2:49

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.