Home > reduc > load > writeTemplateDatabase.m

writeTemplateDatabase

PURPOSE ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

SYNOPSIS ^

function r = writeTemplateDatabase(mjdList,templates)

DESCRIPTION ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 function r = writeTemplateDatabase(mjdList,templates)


   I/O:

   MAS -- 24-April-2012

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function r = writeTemplateDatabase(mjdList,templates)
0002 
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 %
0005 % function r = writeTemplateDatabase(mjdList,templates)
0006 %
0007 %
0008 %   I/O:
0009 %
0010 %   MAS -- 24-April-2012
0011 %
0012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0013 
0014 fprintf('\nWriting the updated template database.  \n\n');
0015 
0016 
0017 [home,installeddir] = where_am_i();
0018 
0019 templateDatabase = [home '/' installeddir '/constants/loadTemplateDatabase.txt'];
0020 
0021 
0022 n_phase = size(templates,1);
0023 n_temp = size(templates,2);
0024 writeLen = n_phase * n_temp;
0025 
0026 
0027 c0 = reshape(repmat(mjdList',n_phase,1),writeLen,1);
0028 c1 = reshape(templates(:,:,1),writeLen,1);
0029 c2 = reshape(templates(:,:,2),writeLen,1);
0030 c3 = reshape(templates(:,:,3),writeLen,1);
0031 c4 = reshape(templates(:,:,4),writeLen,1);
0032 c5 = reshape(templates(:,:,5),writeLen,1);
0033 c6 = reshape(templates(:,:,6),writeLen,1);
0034 c7 = reshape(templates(:,:,7),writeLen,1);
0035 c8 = reshape(templates(:,:,8),writeLen,1);
0036 c9 = reshape(templates(:,:,9),writeLen,1);
0037 c10 = reshape(templates(:,:,10),writeLen,1);
0038 c11 = reshape(templates(:,:,11),writeLen,1);
0039 c12 = reshape(templates(:,:,12),writeLen,1);
0040 c13 = reshape(templates(:,:,13),writeLen,1);
0041 c14 = reshape(templates(:,:,14),writeLen,1);
0042 c15 = reshape(templates(:,:,15),writeLen,1);
0043 c16 = reshape(templates(:,:,16),writeLen,1);
0044 c17 = reshape(templates(:,:,17),writeLen,1);
0045 c18 = reshape(templates(:,:,18),writeLen,1);
0046 c19 = reshape(templates(:,:,19),writeLen,1);
0047 c20 = reshape(templates(:,:,20),writeLen,1);
0048 
0049 C = [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, ...
0050     c12, c13, c14, c15, c16, c17, c18, c19, c20];
0051 
0052 %disp(size(C));
0053 
0054 fid = fopen(templateDatabase,'w');
0055 fprintf(fid, ...
0056     '%10.4f %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g\n', C');
0057 fclose(fid);
0058 
0059 
0060 uname = getenv('USER');
0061 
0062 fprintf(['Now you will commit the updated file to the CVS \n' ...
0063         'so that we can all benefit from your hard work.\n']);
0064 input('Press enter when ready...');
0065 disp('Enter CVS password now if asked:')
0066 system(sprintf('cvs commit -m''%s: alpha database updated'' constants/loadTemplateDatabase.txt',uname));
0067 
0068 
0069 
0070 r = 1;
0071 
0072 end

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005