MATLAB >> How to pass parameters between open GUI's

by Thel Milton » Tue, 17 Feb 2004 20:19:16 GMT

I have a main GUI and another GUI window that is opened, from the
main one,
when the user chooses a specific option. In this secondary GUI I have
to implement an 'OK' button that passes the parameters introduced by
the user
to the main GUI but WITHOUT CLOSING the secondary window, i.e., I
have to pass the
information to the main GUI preserving the second GUI opened.
Failed solutions I have tried:
- using 'varargout': it's only possible closing the window.
- using global variables in the main and second GUI: the main GUI
doesn't recognize them.

Any ideas are wellcome. Thank you in advance.

MATLAB >> How to pass parameters between open GUI's

by Roy S Schestowitz » Tue, 17 Feb 2004 20:38:54 GMT


Try assigning the input from the user to the function's output argument and
then explicitly call <close;>.

Roy

MATLAB >> How to pass parameters between open GUI's

by Steven » Tue, 17 Feb 2004 21:35:09 GMT

If you wait one day, I will send you the solution :-) (tomorrow)

Steven

MATLAB >> How to pass parameters between open GUI's

by knallkopf66 » Tue, 17 Feb 2004 21:55:18 GMT

@Steven

please could you post the solution, i would be interested in it.

thanks a lot, k.



the
I
introduced
I
GUI

MATLAB >> How to pass parameters between open GUI's

by us » Tue, 17 Feb 2004 21:57:54 GMT

Thel Milton:
<SNIP wants to exchange data between different guis>

one of the many solutions: use a container, eg,

% gui1: push your data into the container
% via some callback in your <OK> button

setappdata(0,'gui1',your_data)

% gui2: pull the data back from the container
% via callback from another uicontrol

gui1_data=getappdata(0,'gui1');

see help/doc for these functionse for more info

us

MATLAB >> How to pass parameters between open GUI's

by Thel Milton » Thu, 19 Feb 2004 20:27:34 GMT

Thanks for the idea, I had been trying before with setappdata and so
but using the figure handle instead of a fixed number so it didn't
work, but now I have tryed with 0 as 'us' proposed and it works well.


% in the secondary GUI I use
% the structure of information il
il(1) = num_x;
il(2) = num_y;
% and then store de data
setappdata(0,'UserData',il);

% in the main GUI I wrote after the call
tmp = getappdata(0,'UserData');
xn = tmp(1);
yn = tmp(2);

See ya and thanks again

Rose

Similar Threads

1. passing data between multiple open GUI's

Hello All,

I've been reading posts on passing data back between open gui's and
it seems there is a consensus to use the two functions: setappdata
and getappdata. I guess my question is how do I go about applying
these functions?

Example: I have three GUIs and data needs to be passed between all
three (without closing each GUI before data is passed). I can see
using setappdata for the GUI which is sending the data, but how do
the other two GUI's know when to execute getappdata to update this
same data?

2. GUI passing parameters problem - MATLAB

3. passing parameters to GUI

Dear all,

I have to call one GUI from another GUI , and i want to pass
some parameters to the sub GUI and read back the results (as
we do with Matlab Functions).

Is it possible to do this ?? If possible plz tell me the way
to do.

Thanks in advance,
Regards,
Ashwini






4. passing parameters in gui - MATLAB

5. GUI wont pass parameters to simulink

Hello,


We have built a BER simulator using simulink and after building it we designed a GUI over it so that the parameters can be passed to the model using the front end.
Now the problem is that using the GUI some of the parameters are passed to some blocks and for some blocks there are error messages what ever we do .

for example to pass parameters to the Gain Block(from the communication block set) we use:

x=get(hObject,'String');
y=str2double(x);
open_system('ber3')              %name of our model
open_system('ber3/Rx Dish Antenna Gain');
set_param('ber3/Rx Dish Antenna Gain','Gain',num2str(y));

works perfectly.but for another block Satellite Reciever System Temperature 

x=get(hObject,'String');
y=str2double(x);
open_system('ber3')              %name of our model
open_system('ber3/Satellite Reciever System Temp');
set_param('ber3/Satellite Reciever System Temp','Noise temperature',num2str(y));

does not work and gives the error :

Receiver Thermal noise block (mask) does not have a parameter named 'Noise Temperature'

I have double checked the names and the fact that the 'noise temperature' parameter do exist in the above case.

Any help in this regard would be highly appreciable.

FAHAD SAEED

6. GUI: opening a gui from another gui - MATLAB

7. passing handles in GUI's

Hello,
After searching the exchange, there are still no answers to this
question. I am trying to pass a simple variable 'x' via the handles
structure to control what happens during the timer:

%%%%%%%%%%%%%%%%%% begin code %%%%%%%%%%%%%%%%%%
% starting function
function gui1_OpeningFcn(hObject, eventdata, handles, varargin)
   handles.AQtimer = timer('Name', 'AQtimer', 'TimerFcn',
{@DoOnTimer, handles}, 'Period', 1, 'ExecutionMode', 'fixedRate');
%create timer
   handles.x = 1; % create 'x' variable

% button callback function
function pushbutton1_Callback(hObject, eventdata, handles)
   handles.x = -handles.x % toggle state
   guidata(hObject, handles); % save handles

% timer callback function
function DoOnTimer(hObject, eventdata, handles)
   if (handles.x > 0)
       [do something]
   else
       [do nothing]
   end;
%%%%%%%%%%%%%%%%%% end code %%%%%%%%%%%%%%%%%%

while 'handles.x' can be read and written in 'pushbutton1_Callback,'
it is not recognized in 'DoOnTimer.' This looks like a matter of
using the correct syntax, I would appreciate anyone helping.

Thank you very much!

8. passing values, strings from one GUI to another GUI - MATLAB