Mercurial > hg > octave-lyh
diff scripts/control/strappend.m @ 3228:dbcc24961c44
[project @ 1998-12-09 18:42:12 by jwe]
author | jwe |
---|---|
date | Wed, 09 Dec 1998 18:42:13 +0000 |
parents | ba1c7cdc6090 |
children | 28aba52a2368 |
line wrap: on
line diff
--- a/scripts/control/strappend.m +++ b/scripts/control/strappend.m @@ -16,19 +16,21 @@ # along with Octave; see the file COPYING. If not, write to the Free # Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. -function retval = strappend(str,suffix); - # retval = strappend(str,suffix); - # append string suffix to each string in the string matrix str +function retval = strappend(strlist,suffix); + # retval = strappend(strlist,suffix); + # append string suffix to each string in the list of strings strlist if(nargin != 2 | nargout > 1) - usage(" retval = strappend(str,suffix)"); - elseif(!isstr(str) | !isstr(suffix)) - error("Both arguments must be strings") + usage(" retval = strappend(strlist,suffix)"); + elseif(!is_signal_list(strlist)) + error("strlist must be a list of strings (see is_signal_list)"); + elseif(!(isstr(suffix) & is_vector(suffix))) + error("suffix must be a single string"); endif - for ii=1:rows(str) - newst = [dezero(str(ii,:)),suffix]; - retval(ii,1:length(newst)) = (newst); + retval = list(); + for ii=1:length(strlist) + retval(ii) = sprintf("%s%s",nth(strlist,ii),suffix); endfor endfunction