Buildind special vector? V(3)=V(6)=V(9)...=0

How can I build
V=[1 1 0 1 1 0 1 1 0 1 1 0....]vector.I want to put N value and it will reply me V vector..
Elements fo V will be V(3)=V(6)=V(9)...=0

댓글 수: 1

Azzi Abdelmalek
Azzi Abdelmalek 2013년 3월 6일
You did not explain the relation between N and the result

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

 채택된 답변

Jan
Jan 2013년 3월 6일
편집: Jan 2013년 3월 6일

0 개 추천

Another guess:
V = ones(1, N);
V(3:3:end) = 0;

추가 답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 3월 6일
편집: Azzi Abdelmalek 2013년 3월 6일

0 개 추천

V=[1 1 0 1 1 0 1 1 0 1 1 0]
N=3
V(N:N:end)=0

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

질문:

2013년 3월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by