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

조회 수: 5 (최근 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 CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by