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.

NgLM
  • 1
  • 1
  • Could you at least show the code where you use `methods`? I don’t see it in the code you posted. Please read [mre]. – Cris Luengo Aug 05 '19 at 01: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. – NgLM Aug 06 '19 at 02:49

0 Answers0