Multiplying all values and create a single matrix
1 view (last 30 days)
Show older comments
Hi guys,
Very new to Matlab. If i had for example, a variable Length and a variable Height, for values between 1m and 5m, and i wanted to create a matrix of (1x25), containing all the possible values. eg L*H hence, 1*1, 1*2, 1*3, 1*4, 1*5, 2*1, ... etc. How would i code this?
Thanks
0 Comments
Accepted Answer
the cyclist
on 24 Aug 2013
Edited: the cyclist
on 24 Aug 2013
Here's one way:
H = 1:5;
L = 1:5;
LH = bsxfun(@times,H,L');
LH = LH(:)
2 Comments
More Answers (0)
See Also
Categories
Find more on Resizing and Reshaping Matrices 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!