%This program is written for computer the maximum interstory ratio %automaticly by idarc 2d clc; clear; gm=3; %the number of ground motions sm=20; %the number of times for one ground motions load fac1.txt %this text for gm property load fac2.txt %this text for amplitude ratio for i=1:350 %define an empty 2d array as large as possible for j=1:200 c(i,j)=' '; end end
for gmn=1:gm %the cycle for ground motion for smn=1:sm % the cycle for the computer time for one ground motion with the amplitude ratio fid=fopen('S8L8.dat','r'); %open the input file for i=1:331 tline=fgetl(fid); len=length(tline); for j=1:len c(i,j)=tline(j); end end fclose(fid);
tc1=str2num(c(241,:)); %the program follow for modify the input file tc1(1)=fac2(smn,gmn); tc1(3)=fac1(gmn,4); tc1(4)=fac1(gmn,2); len=length(num2str(tc1)); c(241,1:len)=num2str(tc1);
fid=fopen('S8L8.dat','wt'); %written the input file into the origin file for i=1:350 for j=1:200 fprintf(fid,'%s',c(i,j)); end fprintf(fid,'n'); end fclose(fid); !new.exe;
for i=1:2500 for j=1:250 out(i,j)=' '; end end
%the follow is written for deal with the output file fid=fopen('1.out','r'); for i=1:2500 tline=fgets(fid); len=length(tline); for j=1:len out(i,j)=tline(j); end end fclose(fid);
b=0; for i=1:2500 if out(i,22:37)=='MAXIMUM RESPONSE' b=i; end end
if b==0 for i=1:8 re(8,8)=0; end else
for i=1:8 ree(i,:)=out(b+8+i,:); re(i,:)=str2num(out(b+8+i,:)); end end