Making universal variables in MATLAB GUI

前端 未结 2 544
不知归路
不知归路 2021-01-26 16:27

I\'m kind of new to MATLAB and I\'m doing some experiments for a school project.

What I want is a GUI with 3 buttons, when you press either of the first two, it adds up

2条回答
  •  情深已故
    2021-01-26 17:31

    The following is not the best practice for large complicated programs, but for something simple like what you're trying to do it sounds like global variables would be perfect. Say that X, Y, and Z are the variables you want to share between functions. Add the following at the beginning of every function that uses them, and they will all have access to the same values.

    global X Y Z
    

提交回复
热议问题