%SCRIPT FILE IDGTWS
% 	Script file that reads the model structure from the workspace.
%	The variable XIDarg defines which model structure to use.

%	L. Ljung 4-4-94
%	Copyright (c) 1986-95 by the MathWorks, Inc.
%	$Revision: 1.5 $  $Date: 1995/01/24 00:50:09 $

global XIDparest
XIDnn=get(XIDparest(3),'string');XIDerr=0;
if isempty(XIDnn)
   errordlg('You must supply model orders or a name in the Orders: edit field.');
   return
end

if strcmp(XIDarg,'arx')
	eval('iduiarx(''estimate'',eval(XIDnn),XIDnn);','XIDerr=1;')
elseif strcmp(XIDarg,'io')
	eval('iduiio(''estimate'',eval(XIDnn),XIDnn);','XIDerr=1;')
elseif strcmp(XIDarg,'ss')
	eval('iduiss(''estimate'',eval(XIDnn));','XIDerr=1;')
end
if XIDerr
   errordlg(str2mat(['The variable ',XIDnn,' is not on the Model board'],...
             'and does not exist in the MATLAB workspace.'));
end
clear XIDarg XIDnn goto_ws XIDerr
