From: Luis Lacerda on
I will try to explain thoroughly how my programm works and how the GUIs interact amongst them. My purpose was to build a MRI image simulator which has a principal GUI (simulmain). When you run this GUI, it has 2 pop-up menus ,one edit text and 3 push buttons: image parameters, tabulated values and Kfilter.

In the simulmain.m file, more precisely, in the simulmain_opening_Fcn there are several variables i added to the structure handles (example: handles.slc, handles.FA, handles.TI - line 56/68). I can already say that this is my main question, even though it can be best explained in the next paragraph. How can i, from another GUI, change this values, handles.slc, handles.FA, etc.., i mean, handles that supposedly are inserted in the handles structure but that can't be found when i called them?

Carrying on.. If I push the tabulated Values button and try changing the a button from a button group, values are changed in a table, but recalling my previous question, they arenĀ“t updated in the main GUI, not altering the image that is shown..What i would like to do, is change from this GUI those other handles.

I already know how to do it with the principal objects: first i "send" a propertie called simulmain that contains the handles for that figure, to the GUIs that are called (as can be seen in the first lines of tabValues)

% Remember the handle, and adjust our position
handles.simulmain = varargin{mainGuiInput+1};

% Obtain handles using GUIDATA with the caller's handle
mainHandles = guidata(handles.simulmain);

And i did it by doing:


main = handles.simulmain;
mainHandles = guidata(main);
SselectSlice = mainHandles.selectSlice;
handles.Sllice=169;
set(SselectSlice, 'Value', handles.Sllice);


But when i try to change a handle that is inside an object in simulmain MATLAB displays the followin error:

??? Error using ==> set
Invalid handle object.

Error in ==> tabValues>possValues_SelectionChangeFcn at 190
set(SselectSlice, 'Value', handles.t1_tissue1);

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> tabValues at 42
gui_mainfcn(gui_State, varargin{:});

Error in ==>
@(hObject,eventdata)tabValues('possValues_SelectionChangeFcn',get(hObject,'SelectedObject'),eventdata,guidata(get(hObject,'SelectedObject')))


Error in ==> hgfeval at 63
feval(fcn{1},varargin{:},fcn{2:end});

Error in ==> uitools.uibuttongroup.childAddedCbk>manageButtons at 80
hgfeval(cbk, source, evdata);

??? Error using ==> waitfor
Error while evaluating uicontrol Callback


This is my first question, accessing the handles descending of simulmain' Objetcs, and changing their value from another GUI.

My second and final question is about subplotting in another GUI. For this, i push other buttons in the main GUI: image parameteres button and kfilter. I test the kfilter by clicking the button "test" and 4 suplots appear. If i change the % of columns and rows and test again, it will change, but still present 4 subplots, as it will do if i push the other 4 push buttons. My question is, how can i, recorring to handles or other piece of code, order that subplot to appear precisely over the image shown in the main GUI? (i have measured the dimensions of simulmain (main GUI), and if the subplot appeared exactly in the same position that appears in kfilter, it would fit just perfectly).

I hope it can be clear and if you could help me, i would be so appreciated. Thank you in advance.

I'm really thankful.
Luis Lacerda
From: Jan Simon on
Dear Luis,

> I will try to explain thoroughly how my programm works ...

Sorry, your question was a little bit to throughly for me.
Could you please reduce the description to the minimal needed information, which is needed to reproduce your problem?

But perhaps some others, who are native speakers in opposite to me, can follow your description.

Kind regards, Jan
From: Luis Lacerda on
"Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <i1s2bs$8rf$1(a)fred.mathworks.com>...
> Dear Luis,
>
> > I will try to explain thoroughly how my programm works ...
>
> Sorry, your question was a little bit to throughly for me.
> Could you please reduce the description to the minimal needed information, which is needed to reproduce your problem?
>
> But perhaps some others, who are native speakers in opposite to me, can follow your description.
>
> Kind regards, Jan


Dear Jan,

I am trying to make 4 GUI's interact between themselves and i have 2 questions. The first is how can i define values that i have added to the main Gui's structure (which contains the handles to main GUI), that are not GUI objects?

I have done that by obtaining the structure of the main GUI in another GUI.
example:

main = handles.simulmain;
mainHandles = guidata(main); (obtained the handles for the main GUI structure)
SselectSlice = mainHandles.selectSlice; (selected a handle to a object from the structure)
handles.Sllice=169;
set(SselectSlice, 'Value', handles.Sllice); (defined the value)

what i can't do, is define something else than the main GUI' objects..

The other question is how can i define a subplot in a GUI but show it in another one..Just like definig a plot to appear in another GUI..

Thank you for your reply Jan. I hope i have been clearer in this post..

With my best regards,

Luis
From: Luis Lacerda on
"Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <i1s2bs$8rf$1(a)fred.mathworks.com>...
> Dear Luis,
>
> > I will try to explain thoroughly how my programm works ...
>
> Sorry, your question was a little bit to throughly for me.
> Could you please reduce the description to the minimal needed information, which is needed to reproduce your problem?
>
> But perhaps some others, who are native speakers in opposite to me, can follow your description.
>
> Kind regards, Jan
From: Steven_Lord on


"Luis Lacerda" <luislacerda1989(a)hotmail.com> wrote in message
news:i1s4ql$900$1(a)fred.mathworks.com...
> "Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message
> <i1s2bs$8rf$1(a)fred.mathworks.com>...
>> Dear Luis,
>>
>> > I will try to explain thoroughly how my programm works ...
>>
>> Sorry, your question was a little bit to throughly for me.
>> Could you please reduce the description to the minimal needed
>> information, which is needed to reproduce your problem?
>>
>> But perhaps some others, who are native speakers in opposite to me, can
>> follow your description.
>>
>> Kind regards, Jan
>
>
> Dear Jan,
>
> I am trying to make 4 GUI's interact between themselves and i have 2
> questions. The first is how can i define values that i have added to the
> main Gui's structure (which contains the handles to main GUI), that are
> not GUI objects?

You can add whatever fields you want (as long as their names are valid
struct array field names) to the handles structure.

> I have done that by obtaining the structure of the main GUI in another
> GUI.
> example:
>
> main = handles.simulmain; mainHandles = guidata(main); (obtained the
> handles for the main GUI structure)
> SselectSlice = mainHandles.selectSlice; (selected a handle to a object
> from the structure)
> handles.Sllice=169;
> set(SselectSlice, 'Value', handles.Sllice); (defined the value)

So the copy of the handles structure for the main GUI is mainHandles?

In order to change the "master" copy of the handles structure for the main
GUI, you need to modify the contents of that variable and then use GUIDATA
to update the master copy. The second of those steps is the one that people
forget to do frequently.

> what i can't do, is define something else than the main GUI' objects..
>
> The other question is how can i define a subplot in a GUI but show it in
> another one..Just like definig a plot to appear in another GUI..

I'm not sure I understand this question. Do you mean you want one of the
GUIs to create an axes in another of the GUIs? If so, just use the AXES
function and specify the property name 'Parent' with the handle of the
figure in which you want the axes to be created as the property value.

f1 = figure;
f2 = figure;
axes('Parent', f1)

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com