Index: /issm/trunk-jpl/src/m/exp/expwrite.m
===================================================================
--- /issm/trunk-jpl/src/m/exp/expwrite.m	(revision 14260)
+++ /issm/trunk-jpl/src/m/exp/expwrite.m	(revision 14261)
@@ -14,4 +14,16 @@
 %
 %   See also EXPDOC, EXPREAD, EXPWRITEASVERTICES
+
+%check input variable
+if ~isstruct(a),
+	error('first argument is not a structure');
+end
+
+%Add density if it's not there
+if ~isfield(a,'density'),
+	for n=1:length(a),
+		a(n).density=1;
+	end
+end
 
 fid=fopen(filename,'w');
