Permalink
Browse files

Initial import

  • Loading branch information...
1 parent 99ec342 commit da81496e0c85a8a5d1c2a9849a02cbaf2a99a8ca @widmann committed Aug 17, 2007
Showing with 10 additions and 0 deletions.
  1. +10 −0 zeropad.m
View
@@ -0,0 +1,10 @@
+function [padArr] = zeropad(arr, width, dim)
+
+if nargin < 3 || isempty(dim)
+ dim = 1;
+end
+
+padSize = size(arr);
+padSize(dim) = width - padSize(dim);
+
+padArr = cat(dim, arr, cast(zeros(padSize), class(arr)));

0 comments on commit da81496

Please sign in to comment.