Advertisement
hiddenGem

Increasing 3D Matrix

Jun 29th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.41 KB | None | 0 0
  1. %% Increasing 3D Matrix
  2. % Creates a 3D Matrix with increasing values
  3.  
  4. A = zeros(2,3,4);
  5. number = 1;
  6. for     page = 1:4                       % pages in the matrix
  7.      for   column = 1:3;                 % columns in the matrix
  8.        for     row = 1:2;                % rows in the matrix
  9.                  A(row,column,page) = number;
  10.                  number = number + 1;
  11.        end
  12.      end
  13. end
  14. display(A)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement