Mercurial > repos > public > sbplib
comparison toString.m @ 200:ef41fde95ac4 feature/beams
Merged feature/grids into feature/beams.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 13 Jun 2016 16:59:02 +0200 |
parents | 2ccfe80e9b58 |
children | e1a59aafe99c |
comparison
equal
deleted
inserted
replaced
181:419ec303e97d | 200:ef41fde95ac4 |
---|---|
26 str = 'NO_STR_REP'; | 26 str = 'NO_STR_REP'; |
27 end | 27 end |
28 end | 28 end |
29 | 29 |
30 function str = cell2string(c) | 30 function str = cell2string(c) |
31 len = length(c); | 31 if isempty(c) |
32 | |
33 if len == 0 | |
34 str = '{}'; | 32 str = '{}'; |
35 return | 33 return |
36 end | 34 end |
37 | 35 |
36 [n, m] = size(c); | |
37 | |
38 str = '{'; | 38 str = '{'; |
39 | 39 |
40 for i =1:len-1 | 40 for i = 1:n-1 |
41 str = [str sprintf('%s, ', value2string(c{i}))]; | 41 for j = 1:m-1 |
42 str = [str sprintf('%s, ', value2string(c{i,j}))]; | |
43 end | |
44 str = [str sprintf('%s; ', value2string(c{i,end}))]; | |
42 end | 45 end |
43 str = [str sprintf('%s}', value2string(c{end}))]; | 46 |
47 for j = 1:m-1 | |
48 str = [str sprintf('%s, ', value2string(c{end,j}))]; | |
49 end | |
50 str = [str sprintf('%s}', value2string(c{end,end}))]; | |
44 end | 51 end |
45 | 52 |
46 function str = struct2string(s) | 53 function str = struct2string(s) |
47 fn = fieldnames(s); | 54 fn = fieldnames(s); |
48 | 55 |