How to augment a vector into another vector?

Illustration
Muhammad Sardar Khan - 2023-03-20T12:04:45+00:00
Question: How to augment a vector into another vector?

v1 = [0 1 2 3], v2 = [0 1 2] the resultant v3 =[0 0; 1 0; 2 0; 3 0; 0 1; 1 1; 2 1; 3 1; 0 2; 1 2; 2 2; 3 2]  

Expert Answer

Profile picture of Kshitij Singh Kshitij Singh answered . 2025-11-20

v1 = [0 1 2 3], 
v2 = [0 1 2]
[a,b]=ndgrid(v1,v2)
out=[a(:) b(:)]

 


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!