Index: /issm/trunk/src/m/utils/Model/loadmodel.m
===================================================================
--- /issm/trunk/src/m/utils/Model/loadmodel.m	(revision 7300)
+++ /issm/trunk/src/m/utils/Model/loadmodel.m	(revision 7301)
@@ -16,24 +16,17 @@
 	error(['loadmodel error message: file ' path ' does not exist']);
 end
-%check that the file is readable
-[stat,mess]=fileattrib(path);
-if( stat==0 | mess.UserRead~=1),
-	%error(['loadmodel error message: file ' path ' is not readable (permission denied).']);
-end
-%check number of variables
-if length(whos('-file',path))>1,
-	error(['loadmodel error message: file ' path ' contains several variables. Only one model should be present.']);
-end
 
 try,
-	%recover model and name it md
-	struc=struct(load(path,'-mat'));
-	fieldname=char(fieldnames(struc));
-	md=eval(['struc.' fieldname]);
+	%recover model on file and name it md
+	struc=load(path,'-mat');
+	name=char(fieldnames(struc));
+	if size(name,1)>1,
+		error(['loadmodel error message: file ' path ' contains several variables. Only one model should be present.']); 
+	end
+	md=eval(['struc.' name]);
 	
 	%now, transform md into a new model
 	if ~strcmpi(class(md),'model'),
-		md2=model;
-		md2=structtomodel(md2,md);
+		md2=structtomodel(model,md);
 		md=md2;
 		clear md2;
@@ -42,5 +35,5 @@
 		varargout{1}=md;
 	else
-		assignin('caller',fieldname,md);
+		assignin('caller',name,md);
 	end
 catch me
