You can use the reshape
function to create a matrix from the 3 vectors. The first input to reshape
is the 3 vectors stacked together, and the second input specifies the number of rows and columns in the resulting matrix. Assuming the vectors are named vec1
, vec2
, and vec3
, the code would look like this:
main.m99 chars6 lines
This would create a 4x3 matrix mat
with the following values:
main.m32 chars5 lines
gistlibby LogSnag