Making universal variables in MATLAB GUI -


i'm kind of new matlab , i'm doing experiments school project.

what want gui 3 buttons, when press either of first two, adds 1 on variable (one variable each button), , when press third button, variables first 2 buttons.

i used "guide" , dragged , dropped buttons, , modified functions.

but realized variables exist inside function button, if initialize them restart everytime press button, , there no way third button know value of first two.

is there way make variables present? or pass them function another?

my code it's automatic code generated "guide", v1 = v1+1; in first button callback function , v2 = v2+1 in second one, , disp(v1) disp(v2) in third.

i hope understand mean, i'm not native english speaker so...

anyway, lot, hope it's easy fix.

the following not best practice large complicated programs, simple you're trying sounds global variables perfect. x, y, , z variables want share between functions. add following @ beginning of every function uses them, , have access same values.

global x y z 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -