Mercurial > hg > octave-lyh
comparison scripts/general/postpad.m @ 904:3470f1e25a79
[project @ 1994-11-09 21:22:15 by jwe]
author | jwe |
---|---|
date | Wed, 09 Nov 1994 21:22:15 +0000 |
parents | e79ff1f4df3c |
children | 52a3f38cbfeb |
comparison
equal
deleted
inserted
replaced
903:b3692d63cca3 | 904:3470f1e25a79 |
---|---|
1 function y = postpad(x,l,c) | 1 function y = postpad(x,l,c) |
2 #postpad(x,l) | 2 |
3 #Appends zeros to the vector x until it is of length l. | 3 # postpad(x,l) |
4 #postpad(x,l,c) appends the constant c instead of zero. | 4 # Appends zeros to the vector x until it is of length l. |
5 # postpad(x,l,c) appends the constant c instead of zero. | |
5 # | 6 # |
6 #If length(x) > l, elements from the end of x are removed | 7 # If length(x) > l, elements from the end of x are removed |
7 #until a vector of length l is obtained. | 8 # until a vector of length l is obtained. |
8 | 9 |
9 # Author: | 10 # Author: |
10 # Tony Richardson | 11 # Tony Richardson |
11 # amr@mpl.ucsd.edu | 12 # amr@mpl.ucsd.edu |
12 # June 1994 | 13 # June 1994 |
13 | 14 |
14 if(nargin == 2) | 15 if(nargin == 2) |
15 c = 0; | 16 c = 0; |
16 elseif(nargin<2 || nargin>3) | 17 elseif(nargin<2 || nargin>3) |
17 error("usage: postpad(x,l) or postpad(x,l,c)"); | 18 usage ("postpad(x,l) or postpad(x,l,c)"); |
18 endif | 19 endif |
19 | 20 |
20 if(is_matrix(x)) | 21 if(is_matrix(x)) |
21 error("first argument must be a vector"); | 22 error("first argument must be a vector"); |
22 elseif(!is_scalar(l)) | 23 elseif(!is_scalar(l)) |