Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[req] How to use global variables in MATLAB GUI callback?

Status
Not open for further replies.

leotim

Full Member level 3
Full Member level 3
Joined
Jul 13, 2005
Messages
166
Helped
5
Reputation
10
Reaction score
0
Trophy points
1,296
Activity points
2,596
matlab gui global variable

Hi all,
I want to define some global variables in MATLAB GUI. I need to use these variables in all of my callback functions. i have attached the GUI M-File.

it seems that sing the global declaration does not work in this case. i have defined my global variables in line 57-61, but i can not use these variables in line 120.

Any one can help me?
 

matlab gui callback

you should repaet the definition before line 120. you are working in function edit_p0_KeyPressFcn and you defined your global variable in mygui_OpeningFcn
when you want use your global variable define it before your usage.

example
function a;
global var1 = 10;

function b;
global var1;
var2 = var1; ======> its work try it



leotim said:
Hi all,
I want to define some global variables in MATLAB GUI. I need to use these variables in all of my callback functions. i have attached the GUI M-File.

it seems that sing the global declaration does not work in this case. i have defined my global variables in line 57-61, but i can not use these variables in line 120.

Any one can help me?
 

    leotim

    Points: 2
    Helpful Answer Positive Rating
Well, that did work for me. Just wanted to acknowledge for the assistance I got from your post. Despite being old one, that was a real useful one.
 

Yes, that's true, although it's very strange and unpredictable.

It really works.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top