Index: mttroot/mtt/bin/trans/rbg2abg_m ================================================================== --- mttroot/mtt/bin/trans/rbg2abg_m +++ mttroot/mtt/bin/trans/rbg2abg_m @@ -9,10 +9,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.5 1996/08/25 09:20:32 peter +## General error handling. +## ## Revision 1.4 1996/08/24 17:57:41 peter ## Removed `touch mtt_info.txt' ## ## Revision 1.3 1996/08/24 14:58:56 peter ## Fixed missprint - mtt_err --> mtt_error @@ -76,26 +79,26 @@ #Inform user echo Creating $1_abg.m # Use matrix manipulation to accomplish the transformation $MATRIX > rbg2abg_m.log 2>mtt_error.txt << EOF - infofile = 'mtt_info.txt'; %Convert from the fig version of the bonds to a structured version [rbonds,rstrokes,rcomponents,rports,n_ports] = $1_rbg; [bonds,components] = rbg2abg(rbonds,rstrokes,rcomponents,rports,infofile); %Write the function m-file for the causal bond graph filename = '$1_abg.m'; + filenum = fopen(filename,'w'); c = '%'; - fprintf(filename, 'function [bonds,components,n_ports] = $1_abg\n'); - fprintf(filename, '%s [bonds,components] = $1_abg\n', c); - fprintf(filename, '%s Acausal bond graph created by MTT on %s\n\n', ... + fprintf(filenum, 'function [bonds,components,n_ports] = $1_abg\n'); + fprintf(filenum, '%s [bonds,components] = $1_abg\n', c); + fprintf(filenum, '%s Acausal bond graph created by MTT on %s\n\n', ... c, date); - mat2mfile(bonds, 'bonds', filename); - mat2mfile(components, 'components', filename); - fprintf(filename, 'n_ports = %1.0f;\n', n_ports); + mat2mfile(bonds, 'bonds', filenum); + mat2mfile(components, 'components', filenum); + fprintf(filenum, 'n_ports = %1.0f;\n', n_ports); EOF cat mtt_info.txt