how to define a user defined variable in matlab app without showing it in gui

2 visualizaciones (últimos 30 días)
i have variables which are user defined, but some of them have to be shown in gui and some not, so how to initialize those user defined variable without being shown in gui made.
  4 comentarios
Jan el 9 de Feb. de 2022
I don't get it. The code
a = 5
creates a variable, which is not shown automatically in a user defined GUI. So what exactly is the problem?
Adam Danz
Adam Danz el 9 de Feb. de 2022
How does the user define the variable and in what workspace?

Iniciar sesión para comentar.

Respuestas (1)

Nivedita el 14 de Nov. de 2023
Hello Rashi,
I understand that you want to initialize user defined variables without being shown in the GUI made. In MATLAB App Designer, there are two types of properties you can define: public and private.
Public properties are accessible from outside the app and are shown in the GUI, while private properties are only accessible within the app and are not shown in the GUI.
You can use private properties to store variables that you don't want to show in the GUI. Here's an example of how you can define private properties:
properties (Access = private)
myVar1 = 1; % some default value
myVar2 = 'hi'; % some default value
You can then use these variables anywhere in your app by referring to them as "app.myVar1" and "app.myVar2".
If you want to initialize these variables with user-defined values, you can do so in the startup function of your app:
function startupFcn(app, userVar1, userVar2)
app.myVar1 = userVar1;
app.myVar2 = userVar2;
In this example, "userVar1" and "userVar2" are the user-defined values that you pass to your app when you run it. You can pass these values like this:
myApp(userVar1, userVar2)
In this line, "myApp" is the name of your app, and "userVar1" and "userVar2" are the user-defined values for your variables.
I hope this helped!


Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.


Community Treasure Hunt

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

Start Hunting!

Translated by