0001 function expboxgen(x0,y0,nx,ny,parameter_filename,box_filename)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 nrows=-1;
0018 ncols=-1;
0019 X0=-1;
0020 Y0=-1;
0021 posting=-1;
0022
0023
0024 fid=fopen(parameter_filename,'r');
0025 count=1;
0026 while(1),
0027 tline=fgetl(fid);
0028 if ~isstr(tline), break; end;
0029
0030 ind=findstr('ant125m',tline);
0031 if ~isempty(ind),
0032 a=strsplit(tline,' ');
0033 a=a(2); a=char(a); a=a(1:length(a)-1);
0034 posting=str2num(a);
0035 end
0036
0037
0038 ind=findstr('no. of rows :',tline);
0039 if ~isempty(ind),
0040 a=strsplit(tline,' ');
0041 nrows=str2num(char(a(length(a))));
0042 end
0043
0044 ind=findstr('no. of columns:',tline);
0045 if ~isempty(ind),
0046 a=strsplit(tline,' ');
0047 ncols=str2num(char(a(length(a))));
0048 end
0049
0050 ind=findstr('Upper Left X:',tline);
0051 if ~isempty(ind),
0052 a=strsplit(tline,' ');
0053 X0=str2num(char(a(length(a))));
0054 end
0055
0056 ind=findstr('Upper Left Y:',tline);
0057 if ~isempty(ind),
0058 a=strsplit(tline,' ');
0059 Y0=str2num(char(a(length(a))));
0060 end
0061
0062
0063 end
0064
0065
0066 fclose(fid);
0067
0068 if (X0==-1 | Y0==-1 | nrows==-1 | ncols==-1 | posting==-1),
0069 disp(' ');
0070 disp(['Could not recover all parameters from ' parameter_filename]);
0071 disp('Here are the paramters recovered thus far: ');
0072 disp(['no. of rows: ' num2str(nrows)]);
0073 disp(['no. of columns: ' num2str(ncols)]);
0074 disp(['Upper Left X: ' num2str(X0)]);
0075 disp(['Upper Left Y: ' num2str(Y0)]);
0076 disp(['Posting: ' num2str(posting)]);
0077 end
0078
0079 disp(' ');
0080 disp(['Recovered the following parameters from ' parameter_filename]);
0081 disp(['no. of rows: ' num2str(nrows)]);
0082 disp(['no. of columns: ' num2str(ncols)]);
0083 disp(['Upper Left X: ' num2str(X0)]);
0084 disp(['Upper Left Y: ' num2str(Y0)]);
0085 disp(['Posting: ' num2str(posting)]);
0086
0087
0088 X(1)=X0+x0*posting
0089 Y(1)=Y0-y0*posting
0090 X(2)=X(1);
0091 Y(2)=Y(1)-ny*posting;
0092 X(3)=X(1)+nx*posting;
0093 Y(3)=Y(2);
0094 Y(4)=Y(1);
0095 X(4)=X(3);
0096 plot(X,Y,'r*');
0097
0098
0099 expgen(box_filename,X,Y,1);