clear, clc

A = ones(200);
disp('Timing matrix copy');
tic
   B = A*pi;
toc

clear

A = ones(200);
disp('Timing using for loop');
tic
   for i = 1:length(A(:))
      B(i) = A(i)*pi;
   end
toc

clear
A = ones(200);
disp('Timing using for loop when intialize B');
tic
   B = A; %could use B = ones(200);
   for i = 1:length(A(:))
      B(i) = A(i)*pi;
   end
toc

