function comwksp(op_flag, data, frm_handle);
%COMWKSP Load/Save to workspace from COMMGUI.
%
%WARNING: This is an obsolete function and may be removed in the future.

%  Wes Wang, original design in 1995 X-mas day
%  Jun Wu, last update, Mar-07, 1997
%  Copyright 1996-2002 The MathWorks, Inc.
% $Revision: 1.14 $

if op_flag
   name = 'Export ';
else
   name = 'Import ';
end;

default_color = get(0,'defaultuicontrolbackgroundcolor');
f_h = figure(...
   'Name', [name 'Data for Communications Bit Error Computation.'],...
   'NumberTitle','off',...
   'Unit', 'normal',...
   'MenuBar', 'none',...
   'Position', [.637, .655, .35, .17],...
   'Visible','off',...
   'NextPlot','Add',...
   'color', default_color ...
   );
f_h(6) = axes('position',[0 0 1 1], 'Visible','off', 'next', 'add');   
editable = [1 1 1];
if op_flag 
   subwin_name = get(get(frm_handle, 'Title'), 'String');
   text(.1, .8, [name 'Variables from ' subwin_name ' to Workspace']);
else
   subwin_name = get(get(data, 'Title'), 'String');
   text(.12, .8, [name 'Variables from workspace to ' subwin_name]);
end;
tmp = text(.01, .6, 'Signal to Noise Ratio:');
set(tmp, 'Fontunits', 'normal', 'Fontsize', .09);
tmp = text(.01, .4, 'Bit Error Ratio:');
set(tmp, 'Fontunits', 'normal', 'Fontsize', .09);

f_h(2) = uicontrol('Style','edit',...
   'Unit','norm',...
   'BackgroundColor', editable,...
   'String','snr',...
   'Position', [.4 .5 .55 .15]...
   );
f_h(3) = uicontrol('Style','edit',...
   'Unit','norm',...
   'BackgroundColor', editable,...
   'String','ber',...
   'Position', [.4 .3 .55 .15]...
   );

f_h(4) = uicontrol('Style', 'pushbutton',...
   'Unit', 'norm',...
   'Position', [.2 .05 .2 .12],...
   'String', 'OK',...
   'Callback','comvarb;close(gcf);'...
   );
f_h(5) = uicontrol('Style', 'pushbutton',...
   'Unit', 'norm',...
   'Position', [.6 .05 .2 .12],...
   'String', 'Cancel',...
   'Callback','close(gcf);'...
   );
for i = 2:5
   set(f_h(i), 'FontUnits', 'Normal', ...
      'Fontsize', .3);
end;
set(f_h(1),'Visible','on',...
   'UserData', [f_h, op_flag]);
set(f_h(6),'UserData', data);
waitfor(f_h(4));
