Try
[p,q] = meshgrid(vec1, vec2);
pairs = [p(:) q(:)];
See the MESHGRID documentation. Although this is not exactly what that function is for, but if you squint at it funny, what you are asking for is exactly what it does.
More Related Contents:
- Generating all combinations with repetition using MATLAB
- Plotting logarithmic values in separate graphs [closed]
- Plotting 4 curves in a single plot, with 3 y-axes
- On shape-agnostic slicing of ndarrays
- programmatically press an enter key after starting .exe file in Matlab
- How do I visualize a matrix with colors and values displayed?
- Create a zero-filled 2D array with ones at positions indexed by a vector
- How can I change the values of multiple points in a matrix?
- Construct adjacency matrix in MATLAB
- Replace specific columns in a matrix with a constant column vector
- How can I apply a function to every row/column of a matrix in MATLAB?
- draw ellipse and ellipsoid in MATLAB
- character reconstruction and filling for OCR
- Sweep / chirp signal ends at incorrect frequency
- How to create an executable .exe file from a .m file
- Building a matrix by merging the same row vector multiple times
- Serial communication between Arduino and Matlab is losing data
- Analytical Fourier transform vs FFT of functions in Matlab
- Index of max and min value in an array
- How to deal with overflow and underflow?
- What are the best practices for floating-point comparisons in Matlab?
- Turning y axis upside down in MATLAB
- print variable-name in Matlab
- Is there a way to see the source of a pcode file (.p) in MATLAB?
- Iterating through struct fieldnames in MATLAB
- Save Matlab invisible plot under terminal as an image with same size
- Using OpenGL in Matlab to get depth buffer
- Corner Cases, Unexpected and Unusual MATLAB [closed]
- MATLAB linked list
- How to work with Unix timestamps in Matlab?