Make Combination form 3 kind of variable and each variable have its own value
1 view (last 30 days)
Show older comments
Shahid Said
on 26 Apr 2021
Commented: Fangjun Jiang
on 29 Apr 2021
Hello,
I would like to create combination of 3 Column as below :
Car Lamp Seat
Car1 Lamp1 Seat1
Car2 Lamp2 Seat2
Car3 Lamp3 Seat3
Car4 Lamp 4 Seat4
until maximum combination
then each variable have it own value.
Car Length Height Weight
Car1 2.03 2.0 1800
Car2 2.30 2.1 1750
Car3 2.40 2.3 1630
Car4 2.10 2.0 1560
Car Length Height Weight
Lamp1 2.03 2.0 1800
Lamp2 2.30 2.1 1750
Lamp3 2.40 2.3 1630
Lamp4 2.10 2.0 1560
and seat also have it own spec.
then i would like to put the combination value into formula row by row.
can someone help me?
im still new in using matlab.
thank you very much.
0 Comments
Accepted Answer
Fangjun Jiang
on 26 Apr 2021
Start with this
[x,y,z]=meshgrid(1:4,1:4,1:4);
data=[x(:),y(:),z(:)]
8 Comments
Fangjun Jiang
on 29 Apr 2021
If you need adding tyre, you need to add another dimension.
[x,y,z,w]=ndgrid(1:2, 1:3, 1:4, 1:5);
data=[x(:), y(:), z(:), w(:)]
More Answers (1)
See Also
Categories
Find more on Database Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!