Mercurial > hg > ltpda
comparison m-toolbox/classes/+utils/@xml/cellstr2str.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 | |
2 function str = cellstr2str(c) | |
3 | |
4 if ~isempty(c) | |
5 | |
6 str = '{'; | |
7 | |
8 if ~iscellstr(c) | |
9 error('### The input cell must be a cell of strings. [%s]', utils.helper.val2str(c)); | |
10 end | |
11 | |
12 for cc = 1:size(c,1) | |
13 | |
14 str = [str, '''', maskQuote(c{cc, 1}), '''']; | |
15 for rr = 2:size(c,2) | |
16 str = [str, ', ''', maskQuote(c{cc, rr}), '''' ]; | |
17 end | |
18 | |
19 str = [str '; ']; | |
20 end | |
21 | |
22 str = [str(1:end-2), '}']; | |
23 | |
24 else | |
25 str = sprintf('cell(%d,%d)', size(c)); | |
26 end | |
27 | |
28 end | |
29 | |
30 function str = maskQuote(str) | |
31 str = strrep(str, '''', ''''''); | |
32 end |