필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

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 (최근 30일)
I am trying to generate a vector with specified number of ones in it? Using for loop ,is it possible to generate it?

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2016년 3월 29일
편집: Azzi Abdelmalek 2016년 3월 29일
َََََA=zeros(1,12)
A(1:4)=1
Or
A=[ones(1,4) zeros(1,8)]

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by