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!