how to add a number in a variable in a multiple?

4 ビュー (過去 30 日間)
taimour sadiq
taimour sadiq 2021 年 8 月 3 日
コメント済み: Jakeb Chouinard 2021 年 8 月 4 日
i want to generate a data from zero to 180 degree for that i write
A = 0:45:180;
so i will get
A = 0 45 90 135 180
now i want that each number of Variable a should b multiple of value 'B', if B = 3 then answer should look like
A= 0 0 0 45 45 45 90 90 90 180 180 180

採用された回答

Jakeb Chouinard
Jakeb Chouinard 2021 年 8 月 3 日
If I may direct you to the MATLAB documentation for repelem, you should be able to find exactly what you're looking for. Repelem allows you to repeat elements in a vector or matrix without much fuss, even allowing for different numbers of repeitions if desired.
Good luck and cheers,
Jakeb
  2 件のコメント
taimour sadiq
taimour sadiq 2021 年 8 月 4 日
Thanks Jakeb, Yes it works exactly what i was looking for...
Jakeb Chouinard
Jakeb Chouinard 2021 年 8 月 4 日
Happy to hear! Cheers, Jakeb

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by