How do i make a matrix like this
2 views (last 30 days)
Show older comments
Oskore Mune
on 29 Apr 2018
Commented: Walter Roberson
on 29 Apr 2018
I'm trying to make a matrix with two columns. The second column is from .5 to 20 with .1 increments and i want the first column to have .5 for as many rows the second column gives, but I also want this to happen for .6, .7, .8, .9, 1, 1.1,... and all the way up to 20 with .1 increments in the same matrix.
i put a picture of a small portion for what i'm talking about.
0 Comments
Accepted Answer
Walter Roberson
on 29 Apr 2018
[C1, C2] = ndgrid(0.5:.1:20);
matrix = [C1(:), C2(:)];
3 Comments
KALYAN ACHARJYA
on 29 Apr 2018
Edited: KALYAN ACHARJYA
on 29 Apr 2018
Are you getting the result as per your requirement? The answer is interesting, that's why I have checked it, I got the result as follows-
Walter Roberson
on 29 Apr 2018
You can replace ndgrid() with meshgrid() to get the values in the other order.
More Answers (0)
See Also
Categories
Find more on Graphics Object Programming in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!