フィルターのクリア

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 日間)
nafila aytija
nafila aytija 2016 年 3 月 29 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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