comparison m-toolbox/sltpda/sltpda_fixvar.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 function cmd = sltpda_fixvar(cmd)
2
3 % SLTPDA_FIXVAR replaces various unwanted characters in variable names.
4 %
5 % M Hewitson 11-04-07
6 %
7 % $Id: sltpda_fixvar.m,v 1.2 2007/04/29 12:52:00 hewitson Exp $
8 %
9
10 % some simple replacements
11 cmd = strrep(cmd, ' ', '_');
12 cmd = strrep(cmd, '-', '_');
13 cmd = strrep(cmd, '/', '_');
14 cmd = strrep(cmd, '.', '_');
15
16 % check variable name doesn't begin with number - MATLAB doesn't like this
17 if ~isempty(cmd)
18 n = str2num(cmd(1));
19 if ~isempty(n)
20 if isreal(n)
21 cmd = ['c' cmd];
22 end
23 end
24 end
25 % END