Educational materials

View   r1
CodeReplicatePattern 1 - 21 Jul 2008 - Main.AaronStriegel
Line: 1 to 1
Added:
>
>
META TOPICPARENT name="IntroEngF08LC6"

Notes

  • Needs to be tested

% BigCopy = replicatePattern (A, N)
% Replicate into BigCopy the pattern from A, N times

if N < 0 
   disp 'Error: Value given for N was less than zero, ignoring replication'
   BigCopy = A;
   return
end

BigCopy = A

[initSizeX,initSizeY] = size(A);

% Check for double dimensions (should exit)


for j=1:N
  for k=1:initSizeX
     BigCopy(initSizeX*k+j) = A(j);
  end
end

% Tada, all done!


Revision 1r1 - 21 Jul 2008 - 19:31:39 - AaronStriegel
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Syndicate this site RSSATOM