3213
|
1 # Copyright (C) 1996 A. Scottedward Hodel |
|
2 # |
|
3 # This file is part of Octave. |
|
4 # |
|
5 # Octave is free software; you can redistribute it and/or modify it |
|
6 # under the terms of the GNU General Public License as published by the |
|
7 # Free Software Foundation; either version 2, or (at your option) any |
|
8 # later version. |
|
9 # |
|
10 # Octave is distributed in the hope that it will be useful, but WITHOUT |
|
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 # for more details. |
|
14 # |
|
15 # You should have received a copy of the GNU General Public License |
|
16 # along with Octave; see the file COPYING. If not, write to the Free |
|
17 # Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
18 |
|
19 function outlist(lmat,tabchar,yd,ilist) |
|
20 # function outlist(lmat[,tabchar,yd,ilist]) |
|
21 # |
|
22 # internal use only; minimal argument checking performed |
|
23 # |
|
24 # print an enumerated list of strings |
|
25 # inputs: |
|
26 # lmat: matrix of strings (one per row) |
|
27 # tabchar: tab character (default: none) |
|
28 # yd: indices of strings to append with the string "(discrete)" |
|
29 # (used by sysout; minimal checking of this argument) |
|
30 # yd = [] => all continuous |
|
31 # ilist: index numbers to print with names |
|
32 # default: 1:rows(lmat) |
|
33 # outputs: |
|
34 # prints the list to the screen, numbering each string in order. |
|
35 |
|
36 # A. S. Hodel Dec. 1995 |
|
37 # $Revision: 1.1.1.1 $ |
|
38 |
|
39 save_val = implicit_str_to_num_ok; # save for later |
|
40 implicit_str_to_num_ok = 1; |
|
41 |
|
42 #save for restore later |
|
43 save_empty = empty_list_elements_ok; |
|
44 empty_list_elements_ok = 1; |
|
45 |
|
46 if( (nargin < 1) || (nargin > 4) ) |
|
47 usage("outlist(x[,tabchar,yd,ilist])"); |
|
48 endif |
|
49 |
|
50 [m,n] = size(lmat); |
|
51 if(nargin < 4) |
|
52 ilist = 1:m; |
|
53 endif |
|
54 if(nargin ==1) |
|
55 empty_list_elements_ok = 1; |
|
56 tabchar = ""; |
|
57 endif |
|
58 |
|
59 if(nargin < 3) |
|
60 yd = zeros(1,m); |
|
61 elseif(isempty(yd)) |
|
62 yd = zeros(1,m); |
|
63 endif |
|
64 |
|
65 if((m >= 1) && (isstr(lmat))) |
|
66 for ii=1:m |
|
67 str = dezero([lmat(ii,:),setstr((yd(ii)*" (discrete)"))]); |
|
68 #disp(["length(str)=",num2str(length(str))]) |
|
69 disp([tabchar,num2str(ilist(ii)),": ",str]) |
|
70 endfor |
|
71 else |
|
72 disp([tabchar,"None"]) |
|
73 endif |
|
74 |
|
75 empty_list_elements_ok = save_empty; |
|
76 implicit_str_to_num_ok = save_val; # restore value |
|
77 endfunction |