source: issm/branches/trunk-jpl-damage/src/m/utils/Array/item2str.m@ 12946

Last change on this file since 12946 was 3569, checked in by jschierm, 15 years ago

QMU with Dakota: addition of two new utilities and some error message changes.

  • Property svn:executable set to *
File size: 652 bytes
Line 
1%
2% function to convert an item to a string
3%
4% function [svec]=item2str(a)
5%
6function [svec]=item2str(a)
7
8if islogical(a)
9 if a
10 svec='true';
11 else
12 svec='false';
13 end
14elseif ischar(a)
15 svec=['''' a ''''];
16elseif isnumeric(a)
17 svec=num2str(a);
18else
19 if ~isempty(inputname(1))
20 warning('item2str:item_unrecog',...
21 'Item ''%s'' is of unrecognized type ''%s''.',...
22 inputname(1),class(a));
23 else
24 warning('item2str:item_unrecog',...
25 'Item %d is of unrecognized type ''%s''.',...
26 1,class(a));
27 end
28 return
29end
30
31end
Note: See TracBrowser for help on using the repository browser.