Creating m by m matrix in matlab

  • Context: MATLAB 
  • Thread starter Thread starter sugaku
  • Start date Start date
  • Tags Tags
    Matlab Matrix
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 3K views
sugaku
Messages
16
Reaction score
0
hi all,

i have a vector, z which size is 1 by m.
z = [1 2 3 4 5 6 7 8]

then i want to make a matrix with m by m
Z= [z; z; z; z; z; z; z; z]

if m become bigger i couldn't do it like mentioned above. how could i generate the matrix by a single command?

thank you in advance.
 
Physics news on Phys.org
See the repmat() function. For your purpose its repmat(z, size(z)(2), 1)