diff m-toolbox/classes/+utils/@modules/moduleInfo.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/+utils/@modules/moduleInfo.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,31 @@
+% MODULEINFO returns a structure containing information about the module.
+% 
+% CALL
+%            info = utils.modules.moduleInfo(path_to_module)
+% 
+% Information structure:
+%  
+%           info.name    % module name
+%           info.version % module version
+% 
+% M Hewitson 28-03-11
+% 
+% $Id: moduleInfo.m,v 1.1 2011/03/28 11:27:13 hewitson Exp $
+% 
+
+function info = moduleInfo(varargin)
+  
+  if nargin ~= 1 
+    help(mfilename);
+    error('Incorrect usage');
+  end
+  
+  mpath = varargin{1};
+  
+  xDoc = xmlread(mpath);
+  xRoot = xDoc.getDocumentElement;
+  info.name = char(xRoot.getAttribute('name'));
+  info.version = char(xRoot.getAttribute('version'));  
+  
+end
+% END