www.pudn.com > Kalman_matlab00000.rar > fromfile_callback.m, change:2003-10-27,size:1011b


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% not used in stand-alone exe file % 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
function fromfile_callback 
[fname,pname]=uigetfile('*.txt','Initialize From File'); 
if ~fname 
    return 
end 
s='warndlg(''Cannot Load File:File Format Wrong'',''Warning'');return'; 
 
%eval('load([pname,fname]);',s); 
tname=[[pname] [fname]] 
%load(tname); 
%load('example.txt'); 
F=@load; 
feval(F,tname); 
 
for i=1:length(fname) 
    if fname(i)=='.' 
        break; 
    end 
    name(i)=fname(i); 
end 
n=eval([name,'(1,1)'],s); 
p=eval([name,'(2,1)'],s); 
m=eval([name,'(3,1)'],s); 
 
A=eval([name,'(4:3+n,1:n)'],s); 
B=eval([name,'(n+4:2*n+3,1:p)'],s); 
H=eval([name,'(2*n+4:2*n+3+m,1:n)'],s); 
Q=eval([name,'(2*n+m+4:2*n+m+p+3,1:p)'],s); 
R=eval([name,'(2*n+m+4+p:2*n+2*m+3+p,1:m)'],s); 
P0=eval([name,'(2*n+2*m+4+p:3*n+2*m+3+p,1:n)'],s); 
X0=eval([name,'(3*n+2*m+4+p:4*n+2*m+3+p,1)'],s); 
 
save inidata A B H Q R P0 X0; 
 
CI=findobj(gcf,'tag','compo1'); 
set(CI,'userdata',[]);