MATLAB: MATLAB App Designer: How to hide few of the app components when i run the app

MATLABmatlab app designer

I am trying to create an App where i want to hide some of the components intitially when I run the App. Could someone help me how to do it?
Your help would be highly appreciated. Thank you.

Best Answer

For example, from Component Browser, select app.UIFigure and add StartupFcn callback.
Then in Code View, you can add startupFcn as the follows. You can make components invisible by changing Visible property of components.
function startupFcn(app)
app.Button.Visible = 'off'; % For button
app.UIAxes.Visible = 'off'; % For axes
end
Please replace app.Button or app.UIAxes to your existing components names.
And if you want to make them visible, change Visible properties to 'on'.
app.Button.Visible = 'on';
app.UIAxes.Visible = 'on';