diff m-toolbox/classes/@LTPDAworkbench/fromM.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/@LTPDAworkbench/fromM.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,35 @@
+% FROMM constructs an LTPDA workbench from an LTPDA script file.
+%
+% M Hewitson 17-11-08
+%
+% $Id: fromM.m,v 1.3 2010/09/17 14:09:47 ingo Exp $
+%
+function wb = fromM(wb, fname)
+  
+  wb = LTPDAworkbench();
+  
+  cmds = {};
+  
+  % get file parts
+  [pathstr,name,ext] = fileparts(fname);
+  min = textread(fname,'%s','delimiter','\n','whitespace','');
+  
+  for kk=1:numel(min)
+    line = strtrim(min{kk});
+    % Exceptions:
+    %   empty lines
+    %   comment lines
+    %   mc
+    if ~isempty(line) && ...
+        line(1) ~= '%' && ...
+        ~strcmp(line, 'mc')
+      
+      cmds = [cmds min(kk)];
+    end
+  end
+  
+  % Now build the pipline
+  wb.cmds2pipeline(fname, cmds);
+  
+end
+