How do i make a matrix like this
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Walter Roberson
2018-4-29
[C1, C2] = ndgrid(0.5:.1:20);
matrix = [C1(:), C2(:)];
3 个评论
KALYAN ACHARJYA
2018-4-29
编辑:KALYAN ACHARJYA
2018-4-29
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
2018-4-29
You can replace ndgrid() with meshgrid() to get the values in the other order.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!