uff55r.m
function [V,V_Hdr]=uff55red(fname);
% This script is designed to read universal Type 55 datasets (Mode shapes)
% This program currently is restricted to use on universal files that only
% contain Type 55 datasets. It can be used with several of the available
% subsets of this type and is commented throughout to help in updating (I hope)
% The function call is;
% [V,V_Hdr]=uff55red(fname)
%
% The return variables are; the Mode shape matrix, V(No,4*Nm) & header, V_Hdr
% Nm is the number of modes and No is the number of output nodes.
% The columns of V contain the node names and the 3DOF shape vector as such;
% V=[Node label, X response, Y response, Z response, Node label, ...].
% Yes, I know it is not the most efficient way to store them, but it is the
% fastest to code. The descriptor matrix, V_Hdr, which contains
% pertinent variables returned from the universal data set, analysis type,
% load case, mode #,... If you need further information about the variables
% either look through the script, look through the Universal file desriptions
% in the IDEAS Manual or call UC/SDRL (513)-556-2720
% Author: John F. Schultze
% University of Cincinnati /
% Structural Dynamics Research Lab
% Cincinnati, Ohio 45221
% Date: August 12,1993
clear Analtype SDT
Analtype=['Unknown','Static ','Normal ','Complex','ConjCom'];
SDT=['None ','Displ','Veloc','Accel'];
chk=1;
while (chk==1)
%fname=input('file name to read (uff55 only) ','s');
chk=isempty(fname);
if (chk==1)
disp('No Name entered. Try Again');
disp(' ');
end
end
clear chk
ss=['opening file ',fname];
disp(ss)
fid=fopen(fname);
chk=0;
clear V V_Hdr
clear recno; % record number for H and Hdr
recno=0
while (chk==0)
junk=fgetl(fid);
if(junk==-1); % EOF
disp('EOF Encountered');
chk=99;
end
if (chk==0);
%line -1
junk=str2num(junk);
if (junk ~= -1);
disp('not universal file dataset')
chk=-1;
end
disp('starting data set read')
end
if (chk==0);
%line 0
junk=str2num(fgetl(fid));
if (junk ~= 55);
ss=sprintf('not dataset 55, type %g',junk) ;
disp(ss);
chk=-2;
end
disp('reading data set type 55')
end
if (chk==0)
% intialize counters and storage
recno=recno+1
Vshift=(recno-1)*4;
%line 1-5
for ii=1:5;
junk=fgetl(fid);
end
%line 6 (6I10)
junk=fgetl(fid);
clear mt anal datchr spdata datype ndv
mt= str2num(junk( 1:10)); % model type
anal= str2num(junk(11:20)); % analysis type
datchr= str2num(junk(21:30)); % data characteristics
spdata= str2num(junk(31:40)); % specific data type
datype= str2num(junk(41:50)); % data type
ndv= str2num(junk(51:60)); % number of data values/node
V_Hdr(recno,8:10)=[anal,spdata,datype];
if ((anal==0) | (anal==1)); % Unknown or Static
clear lc mn Ma Mb Mr lambda zr er
%line 7 (8I10)
junk=fgetl(fid);
clear lc mn
lc= str2num(junk(21:30)); % id number/load case
%line 8
junk=fgetl(fid);
mn=0;
Ma=0;
Mb=0;
Mr=0;
lambda=0;
zr=0;
er=0;
end
if (anal==2) % Normal Mode
clear lc mn whz Mr zr er mag ang Ma Mb lambda
%line 7 (8I10)
junk=fgetl(fid);
lc=str2num(junk(21:30)); % load case
mn=str2num(junk(31:40)); % mode number
%line 8 (8I10)
junk=fgetl(fid);
whz= str2num(junk( 1:13)); % mode freq Hz
Mr= str2num(junk(14:26)); % Modal mass
zr= str2num(junk(27:39)); % modal visc damping
er= str2num(junk(40:52)); % modal hyst damping
mag=2*pi*whz;
ang=pi/2+asin(zr); %neglecting er
lambda=mag*(cos(ang)+j*sin(ang));
Ma=0;
Mb=0;
end
if(abs(anal)==3) % Complex or Complex Conj
clear lc mn lambda Ma Mb Mr er zr
%line 7 (8I10)
junk=fgetl(fid);
lc=str2num(junk(21:30)); % load case
mn=str2num(junk(31:40)); % mode number
%line 8 (8I10)
junk=fgetl(fid);
lambda= str2num(junk( 1:13))+...
j*str2num(junk(14:26)); % Eigenvalue of mode
Ma= str2num(junk(27:39))+...
j*str2num(junk(40:52)); % Modal A
Mb= str2num(junk(53:65))+...
j*str2num(junk(66:78)); % Modal B
zr= angle(lambda)-pi/2; % modal visc damping
er= 0.; % modal hyst damping and Modal mass
Mr= 0.; % set equal to zero
end
if (isempty(Ma)==1); Ma=0; end
if (isempty(Mb)==1); Mb=0; end
V_Hdr(recno,1:7)=[mn,lambda,zr,Mr,er,Ma,Mb];
chk2=0;
nl=0;
while(chk2==0);
%line 9-10 for each node
%line 9
junk=fgetl(fid);
if(junk==-1); % EOF
chk2=99;
disp('EOF Encountered');
chk=99;
end
if(junk~=-1)
if(str2num(junk(5:6))==-1) % end of dataset
tst2=0;
chk2=66; % kick out of this loop and start
% new data set
disp('End of data set encountered')
end
end
if (chk2==0);
nl=nl+1;
node= str2num(junk(1:10));
V(nl,1+Vshift)=node;
%line 10
junk=fgetl(fid);
if (abs(anal)~=3); % real valued
x= str2num(junk( 1:13));
y= str2num(junk(14:26));
z= str2num(junk(27:39));
end
if (abs(anal)==3); % complex valued
x= str2num(junk( 1:13))+...
j*str2num(junk(14:26));
y= str2num(junk(27:39))+...
j*str2num(junk(40:52));
z= str2num(junk(53:65))+...
j*str2num(junk(66:78));
end
V(nl,Vshift+2:Vshift+4)=[x,y,z];
end; % chk2 if loop
end; % chk2 while loop
end; %chk if loop
end; % chk while loop