Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Is it possible to create a vector with a specified number of ones? eg . V=[ 1 1 1 1 0 0 0 0 0 0 0 0]

2 visualizzazioni (ultimi 30 giorni)
I am trying to generate a vector with specified number of ones in it? Using for loop ,is it possible to generate it?

Risposte (1)

Azzi Abdelmalek
Azzi Abdelmalek il 29 Mar 2016
Modificato: Azzi Abdelmalek il 29 Mar 2016
َََََA=zeros(1,12)
A(1:4)=1
Or
A=[ones(1,4) zeros(1,8)]

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by