Question
I am trying to find all possible combinations of three vectors (A,B,C). For this, I tried using combvec. However, the result gets me a 1281x1 double, while i expected a matrix of 546*33*649 possibilities. What i would like to get is: A: 1,5,6,9,12 B: 1,2,3,4,5,6 C: 3,18,27,69,72 Ans: 1,1,3 1,1,18 1,1,27 etc. So how do i do this?
Expert Answer
Prashant Kumar
PhD Expert
Answered Nov 20, 2025
One possible way, which doesn't require any toolbox:
[ca, cb, cc] = ndgrid(A, B, C); combs = [ca(:), cb(:), cc(:)]
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related deep learning Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →