diff m-toolbox/classes/+utils/@prog/funchash.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/@prog/funchash.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,38 @@
+function h = funchash(fcnname)
+
+% FUNCHASH compute MD5 hash of a MATLAB m-file.
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DESCRIPTION: FUNCHASH compute MD5 hash of a MATLAB m-file.
+%
+% CALL:       h = funchash(mfile_name)
+%
+% INPUTS:     fcnname - The name of an m-file.
+% 
+% The first file found by 'which' is hashed.
+%
+% OUTPUTS:    h  - the hash string
+%
+% PARAMETERS: None.
+% 
+% EXAMPLES:
+% 
+%     >> h = funchash('ao');
+% 
+% VERSION:     $Id: funchash.m,v 1.1 2008/06/18 13:35:11 hewitson Exp $
+%
+% HISTORY: 21-11-07 M Hewitson
+%            Creation.
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% Get filename
+s = which(fcnname);
+
+% Read in file
+mfile = textread(s,'%s','delimiter','\n','whitespace','');
+
+% hash this
+h = ltpda_hash(char(mfile), 'MD5');
+