Index: /issm/trunk/src/c/EnumDefinitions/SynchronizeMatlabEnum.sh
===================================================================
--- /issm/trunk/src/c/EnumDefinitions/SynchronizeMatlabEnum.sh	(revision 3780)
+++ /issm/trunk/src/c/EnumDefinitions/SynchronizeMatlabEnum.sh	(revision 3781)
@@ -11,8 +11,8 @@
 cat EnumDefinitions.h | grep "[Aa-Zz]Enum" | grep -v StringAsEnum | sed -e "s/,//g" | awk '{ printf "%s %s\n", NR, $0 }' > temp
 
-#Build header of AnalysisTypeFromEnum.m{{{
-cat <<END > AnalysisTypeFromEnum.m
-function string=AnalysisTypeFromEnum(enum)
-%ANALYSISASENUM - get analysis type from Enum
+#Build header of EnumAsString.m {{{1
+cat <<END > EnumAsString.m
+function string=EnumAsString(enum)
+%ENUMASSTRING - output string associated with enum
 %
 %   WARNING: DO NOT MODIFY THIS FILE
@@ -21,8 +21,22 @@
 %
 %   Usage:
-%      string=AnalysisTypeFromEnum(enum)
+%      string=EnumAsString(enum)
 
-%initialize output
-string='not found';
+switch enum,
+
+END
+#}}}
+#Build header of StringAsEnum.m {{{1
+cat <<END > StringAsEnum.m
+function enum=StringAsEnum(name)
+%STRINGASENUM - output enum associated with string
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/SynchronizeMatlabEnum
+%            Please read src/c/README for more information
+%
+%   Usage:
+%      enum=StringAsEnum(name)
+
 END
 #}}}
@@ -35,5 +49,6 @@
 
 	#Get name and enum of the line i
-	NAME=$(cat temp | grep "^[ ]*$i " | awk '{printf("%s",$2);}');
+	NAMEENUM=$(cat temp | grep "^[ ]*$i " | awk '{printf("%s",$2);}');
+	NAME=$(echo $NAMEENUM | sed -e "s/Enum//g")
 	ENUM=$i;
 	#offset Enum by one (Enum begins with 0 and not 1!)
@@ -57,7 +72,7 @@
 	#}}}
 	#Add case to matlabenum file{{{
-	cat <<END > $(echo $NAME".m")
-function macro=$(echo $NAME)()
-%$(echo `echo $NAME | sed -e "s/[a-z]/\U&/g"`) - Enum of $(echo `echo $NAME | sed -e "s/Enum//"`)
+	cat <<END > $ISSM_DIR"/src/m/enum/"$(echo $NAMEENUM".m")
+function macro=$(echo $NAMEENUM)()
+%$(echo $NAMEENUM | sed -e "s/[a-z]/\U&/g") - Enum of $(echo $NAME)
 %
 %   WARNING: DO NOT MODIFY THIS FILE
@@ -66,32 +81,40 @@
 %
 %   Usage:
-%      macro=$NAME()
+%      macro=$NAMEENUM()
 
 macro=$ENUM;
 END
 #}}}
-#Add case to AnalysisTypeFromEnum file{{{
-	if [ $(echo $NAME | grep AnalysisEnum) ]
+#Add case to EnumAsString.m {{{
+cat <<END >> EnumAsString.m
+	case $NAMEENUM(), string='$NAME'; return
+END
+#}}}
+	#Add case to StringAsEnum.m {{{
+	if [ $i -eq 1 ]
 	then
-		cat <<END >> AnalysisTypeFromEnum.m
-
-if enum==$NAME(),
-	string='$(echo `echo $NAME | sed -e "s/AnalysisEnum//g" | awk {'print tolower($_)'}`)';
-end
+		cat <<END >> StringAsEnum.m
+if (strcmpi(name,'$NAME')), enum=$NAMEENUM(); return
+END
+	else
+		cat <<END >> StringAsEnum.m
+elseif (strcmpi(name,'$NAME')), enum=$NAMEENUM(); return
 END
 	fi
 #}}}
 
-	#move file to m/enum
-	mv $NAME".m" $ISSM_DIR"/src/m/enum/"
-
 done
 
-#Footer of AnalysisTypeFromEnum.m{{{
-cat <<END >> AnalysisTypeFromEnum.m
+#Add footer of of EnumAsString.m{{{1
+cat <<END >> EnumAsString.m
+	otherwise, error(['Enum ' num2str(enum)  ' not found']);
 
-%check that an analysis type has been found for enum
-if strcmp(string,'not found'),
-	error(['AnalysisTypeFromEnum error message: enum ' num2str(enum) ' not supported!']);
+end
+END
+#}}}
+#Add footer of of StringAsEnum.m{{{1
+cat <<END >> StringAsEnum.m
+else error(['Enum ' name  ' not found']);
+
 end
 END
@@ -99,5 +122,6 @@
 
 #clean up{{{
-mv AnalysisTypeFromEnum.m $ISSM_DIR/src/m/enum/
+mv StringAsEnum.m $ISSM_DIR/src/m/enum/
+mv EnumAsString.m $ISSM_DIR/src/m/enum/
 rm temp
 #}}}
Index: /issm/trunk/src/c/EnumDefinitions/SynchronizeStrings.sh
===================================================================
--- /issm/trunk/src/c/EnumDefinitions/SynchronizeStrings.sh	(revision 3780)
+++ /issm/trunk/src/c/EnumDefinitions/SynchronizeStrings.sh	(revision 3781)
@@ -21,5 +21,5 @@
 
 #include "../shared/shared.h"
-#include "../include/macros.h"
+#include "../include/include.h"
 #include "./EnumDefinitions.h"
 
@@ -42,5 +42,5 @@
 
 #include "../shared/shared.h"
-#include "../include/macros.h"
+#include "../include/include.h"
 #include "./EnumDefinitions.h"
 
