How do I create this vector: [10,8,10,8,10, ...]?

How can I create a vector that alternates 10 and 8 100 times?

댓글 수: 1

Randy Souza
Randy Souza 2013년 4월 15일
I have restored the original text of this question.
@Malak: this question has a clear subject and an accepted answer, so it may be valuable to someone else in the future. If you have a good reason why it should be removed from MATLAB Answers, please flag the question, explain why it should be deleted, and an administrator or high-reputation contributor will consider deleting the question. Please do not simply edit your question away.

댓글을 달려면 로그인하십시오.

 채택된 답변

Iman Ansari
Iman Ansari 2013년 4월 14일

2 개 추천

Hi
a=zeros(1,100);
a(1:2:99)=10;
a(2:2:100)=8;

추가 답변 (1개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

질문:

2013년 4월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by