Mercurial > repos > public > sbplib
comparison toString.m @ 44:92247f4bad2f
Added toString function.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 05 Nov 2015 16:28:14 -0800 |
parents | 54d3ab296ba0 |
children | edccf4ba788b |
comparison
equal
deleted
inserted
replaced
43:a2b95af82f68 | 44:92247f4bad2f |
---|---|
9 | 9 |
10 str = value2string(value); | 10 str = value2string(value); |
11 end | 11 end |
12 | 12 |
13 function str = value2string(value) | 13 function str = value2string(value) |
14 if isnumeric(value) || ischar(value) | 14 if isnumeric(value) || ischar(value) || islogical(value) |
15 str = mat2str(value); | 15 str = mat2str(value); |
16 elseif isstruct(value) | 16 elseif isstruct(value) |
17 str = struct2string(value); | 17 str = struct2string(value); |
18 elseif iscell(value) | 18 elseif iscell(value) |
19 str = cell2string(value); | 19 str = cell2string(value); |
20 elseif isa('function_hande') | 20 elseif isa(value,'function_hande') |
21 str = func2str(value); | 21 str = func2str(value); |
22 else | 22 else |
23 warning('No string representation for class ''%s''', class(value)) | 23 warning('No string representation for class ''%s''', class(value)) |
24 str = 'NO_STR_REP'; | 24 str = 'NO_STR_REP'; |
25 end | 25 end |