Advertisement
Guest User

Untitled

a guest
Apr 17th, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.47 KB | None | 0 0
  1. function A = stretchmat( a, B )
  2.     %% A = stretchmat( a, B )
  3.     %
  4.     % Inputs
  5.     % a - Vector to stretch by repeating
  6.     % B - Matrix size to match
  7.    
  8.     % Calc Dim Scale
  9.     s = size(B)./size(a);
  10.    
  11.     % Error Check
  12.     if prod(round(s) ~= s)
  13.         disp( 'Error: Size of B cannot be equally divided into the size of a. Check dimensions of parameters.' );
  14.         A = 0;
  15.         return
  16.     end
  17.    
  18.     %% Calculate Stretch
  19.     A = repmat(a, s );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement