3 questions about guide
1 view (last 30 days)
Show older comments
hy and i'm glad i joined this community with so many experts - im not one of them :(. hope someone can help me. i do have some problems with guide and my gui. # 1st. i have to make a big project, with many different figures.its about a digital signals platform. i've made my template with my most important content, that doesn't change in the rest of the figures( menues, toolbars, and some static text and buttons). the first problem is how to code the menu items so when i open, lets say lab1/something, the current window close and open the something.fig from folder lab1. i used closereq; openfig('C:\snumerice\lab1\esantionare.fig'); but if i use this combination the new window opened doesn't initialize OpeningFcn callback and its preatty useless. what should i use? # 2nd. i have a static text that initialise at OpeningFcn with a string from an external file. the problem is that the file is txt and its pretty ugly with no formating at all. i want to initialise a .rtf or BETTER a word document with all its formating. is there any combination so i can modify String of a static text with content of a word doc? and# 3rd.i have read so much help files, but i still don't know how to make some global variables, to be used in the .m file. where can i define them so they could be used in my .m file from my gui, ex in a callback from one of my buttons and the same variable in another callback from other button.
Thx and i really hope someone cand help me with my questions.
2 Comments
Arturo Moncada-Torres
on 25 May 2011
As a tip, try asking different questions in different posts please ;-) !
Accepted Answer
Arturo Moncada-Torres
on 25 May 2011
Regarding your Question #3, you can use the handles structure. There, you can store variables that have a scope for all the callbacks. For example:
% Callback from element 1
% Choose default output
handles.output = hObject;
% ...
handles.myVariable = 1;
% ...
% Update handles structure
guidata(hObject, handles);
% Callback from element 2
% Choose default output
handles.output = hObject;
% ...
handles.myVariableCopy = handles.myVariable;
% ...
% Update handles structure
guidata(hObject, handles);
It is pretty easy actually. Hope it helps ;-) !
3 Comments
More Answers (0)
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!