Artifact 5285512dcf6acb16d3213b35d19d60ed7079fd611002deb03307123d8ceaa19c:
- Executable file
mttroot/mtt/bin/trans/txt2m
— part of check-in
[33db0d0c43]
at
1998-07-26 09:50:12
on branch origin/master
— More forgiving of txt sytax.
-- can use () or ()
-- can use mttx() or x()
-- can use mttu() or u() (user: gawthrop@users.sourceforge.net, size: 1606) [annotate] [blame] [check-ins using]
#! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### # Bourne shell script: txt2m # Converts txt file to matlab file (for numpar and state) # Copyright (c) P.J.Gawthrop 1998 # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # %% Version control history # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # %% $Id$ # %% $Log$ # %% Revision 1.3 1998/07/25 20:40:35 peterg # %% All vars in lower case now # %% # %% Revision 1.2 1998/07/25 09:48:31 peterg # %% Tidied up for Pascal version # %% # %% Revision 1.1 1998/02/25 22:10:25 peterg # %% Initial revision # %% # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% system=$1 representation=$2 if [ "$representation" = "state" ]; then name='mttx'; arg=''; fi if [ "$representation" = "input" ]; then name='mttu'; arg='(mttx,mttt)' fi # Inform user echo Creating $1_$2.m #Create the $2 file complete with headers. echo "function $name = $1_$2$arg" > $1_$2.m echo "%% $2 file ($1_$2.m)" >> $1_$2.m echo "%% Generated by MTT at `date`" >> $1_$2.m # Global variable list #echo >> $1_$2.m #echo 'if (nargin==0), t=0; end;'>> $1_$2.m #echo >> $1_$2.m echo "% Global variable list" >> $1_$2.m sympar2global_txt2m $1 >> $1_$2.m #echo "global DT;" >> $1_$2.m #Write out the variables in m format. awk -F# '{ if (NF<2) print $1 if (NF>1) print $1 "# " $2 }' $1_$2.txt | \ sed 's/\[\([0-9]*\)\]/(\1)/g' |\ sed 's/x(/mttx(/g' | sed 's/u(/mttu(/g' |\ sed 's/mttmtt/mtt/g' >> $1_$2.m