How can I create array of numbers +5 the previous number?
2 ビュー (過去 30 日間)
古いコメントを表示
I want to create an array like this
1 5 10 15 etc.
I want to create an array doing +5 the previous number
How can I do it?
1 件のコメント
回答 (1 件)
Sindar
2020 年 2 月 21 日
start_num = 1;
end_num = 15;
x=[start_num:5:end_num];
% note that 15 is not included since 1+5+5+5=16
If you actually want the example you gave:
end_num = 15;
x = [1 5:5:end_num];
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Multidimensional Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!