comparison m-toolbox/classes/@minfo/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 writes a command string that can be used to recreate the input minfo object.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: STRING writes a command string that can be used to recreate
5 % the input minfo object.
6 %
7 % CALL: cmd = string(minfo)
8 %
9 % VERSION: $Id: string.m,v 1.1 2009/07/17 11:17:26 ingo Exp $
10 %
11 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12
13 function varargout = string(varargin)
14
15 mi = utils.helper.collect_objects(varargin(:), 'minfo');
16
17 cmd = '';
18 for j=1:numel(mi)
19
20 plstr = string(mi(j).plists);
21 if isempty(plstr)
22 plstr = '[]';
23 end
24
25 mistr = 'minfo(';
26 mistr = [mistr, utils.helper.val2str(mi(j).mname), ', '];
27 mistr = [mistr, utils.helper.val2str(mi(j).mclass), ', '];
28 mistr = [mistr, utils.helper.val2str(mi(j).mpackage), ', '];
29 mistr = [mistr, utils.helper.val2str(mi(j).mcategory), ', '];
30 mistr = [mistr, utils.helper.val2str(mi(j).mversion), ', '];
31 mistr = [mistr, utils.prog.cell2str(mi(j).sets), ', '];
32 mistr = [mistr, plstr, ', '];
33 mistr = [mistr, num2str(mi(j).argsmin), ', '];
34 mistr = [mistr, num2str(mi(j).argsmax), ', '];
35 mistr = [mistr, num2str(mi(j).outmin), ', '];
36 mistr = [mistr, num2str(mi(j).outmax), ', '];
37 mistr = [mistr, mat2str(mi(j).modifier), ') '];
38
39 cmd = [cmd mistr];
40
41 end
42
43 %%% Wrap the command only with brackets if the there are more than one object
44 if numel(mi) > 1
45 cmd = ['[' cmd(1:end-1) ']'];
46 end
47
48 % set output
49 varargout{1} = cmd;
50 end
51