www.pudn.com > Closid30.rar > CLLOAD.M, change:1997-04-29,size:1354b


function [err,w1,w2,w3,w4]=clload(filnam,v1,v2,v3,v4) 
% [err,w1,w2,w3,w4]=clload(filnam,v1,v2,v3,v4) 
% 
% LOAD the variables with names v1 till v4 from file "filnam.mat" 
%      and assign the values to the variables w1 till w4. 
%      v2-v4 and w2-w4 are optional. 
% NOTE This is a dangerous operation because the matlab load 
%      operation may interfere with this function if the file 
%      filnam contains variables with names which are used in 
%      this function. 
 
% Functions called: cldebl, clerrdia 
 
% 1-11-1996 
% (c) Peter Heuberger, Paul Van den Hof, Edwin van Donkelaar 
% Mechanical Engineering Systems and Control Group 
% Delft University of Technology 
% Last update: 29-04-1997 
 
 
FILNAMMM=cldebl(filnam); 
COML=['load ' FILNAMMM]; 
 
for i=1:nargin-1 
    si=num2str(i); 
    str1=['COMMMMMMMMMMMMMMMM' si]; 
    str2=['''w' si '=' eval(['v' si]) ';''']; 
    eval([str1 '=[' str2 '];']); 
    eval(['w' si '=[];']); 
end 
 
err=0; 
eval(COML,'err=1;'); 
if err==1 
   clerrdia(['ERROR IMPORTING: cannot load file: ' FILNAMMM],1); 
   return 
end 
 
for iiiii=1:nargin-1 
    siiii=num2str(iiiii); 
    eval(eval(['COMMMMMMMMMMMMMMMM' siiii]),['err=' siiii ';']); 
    if err==iiiii 
       clerrdia(['ERROR IMPORTING: cannot locate variable: ' eval(['v' siiii]) ' in file: ' FILNAMMM],1); 
       return 
    end 
end