comparison m-toolbox/classes/@unit/string.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 % STRING converts a unit object to a command string which will recreate the unit object.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: STRING converts a unit object to a command string which will
5 % recreate the unit object.
6 %
7 % CALL: cmd = string(u)
8 %
9 % VERSION: $Id: string.m,v 1.4 2011/02/18 16:48:55 ingo Exp $
10 %
11 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12
13 function varargout = string(varargin)
14
15 objs = [varargin{:}];
16
17 pstr = '[ ';
18
19 for ii = 1:numel(objs)
20 pstr = [pstr 'unit('''];
21 pstr = [pstr strrep(strrep(char(objs(ii)), '[', ' '), ']', ' ')];
22 pstr = [pstr ''') '];
23
24 end
25
26 pstr = [pstr ']'];
27
28 varargout{1} = pstr;
29 end
30