comparison scripts/strings/str2mat.m @ 3705:7e90f4e9a4d5

[project @ 2000-07-22 01:57:25 by jwe]
author jwe
date Sat, 22 Jul 2000 01:57:28 +0000
parents f8dde1807dee
children e0b7a493e5a8
comparison
equal deleted inserted replaced
3704:aef06675c94d 3705:7e90f4e9a4d5
45 45
46 nr = zeros (nargin, 1); 46 nr = zeros (nargin, 1);
47 nc = zeros (nargin, 1); 47 nc = zeros (nargin, 1);
48 for k = 1 : nargin 48 for k = 1 : nargin
49 s = va_arg (); 49 s = va_arg ();
50 if (isstr (s)) 50 if (! isstr (s))
51 [nr(k), nc(k)] = size (s); 51 s = setstr (s);
52 else
53 error ("str2mat: all arguments must be strings");
54 endif 52 endif
53 [nr(k), nc(k)] = size (s);
55 endfor 54 endfor
56 55
57 tmp = find (nr == 0); 56 tmp = find (nr == 0);
58 57
59 if (! isempty (tmp)) 58 if (! isempty (tmp))
68 va_start (); 67 va_start ();
69 68
70 row_offset = 0; 69 row_offset = 0;
71 for k = 1 : nargin 70 for k = 1 : nargin
72 s = va_arg (); 71 s = va_arg ();
72 if (! isstr (s))
73 s = setstr (s);
74 endif
73 if (nc(k) > 0) 75 if (nc(k) > 0)
74 retval ((row_offset + 1) : (row_offset + nr(k)), 1:nc(k)) = s; 76 retval ((row_offset + 1) : (row_offset + nr(k)), 1:nc(k)) = s;
75 endif 77 endif
76 row_offset = row_offset + nr(k); 78 row_offset = row_offset + nr(k);
77 endfor 79 endfor