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 Kommentar

Azzi Abdelmalek
Azzi Abdelmalek am 6 Mär. 2013
You did not explain the relation between N and the result

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Jan
Jan am 6 Mär. 2013
Bearbeitet: Jan am 6 Mär. 2013

0 Stimmen

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

Weitere Antworten (1)

Azzi Abdelmalek
Azzi Abdelmalek am 6 Mär. 2013
Bearbeitet: Azzi Abdelmalek am 6 Mär. 2013

0 Stimmen

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

Kategorien

Mehr zu Language Fundamentals finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 6 Mär. 2013

Community Treasure Hunt

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

Start Hunting!

Translated by