create a vector of 0 and 1s that takes 1 at a fixed interval
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
alpedhuez
am 14 Aug. 2020
Beantwortet: Sulaymon Eshkabilov
am 14 Aug. 2020
I would like to create a vector of 0s that takes 1 at a given (m) interval. For example, if m=2, the vector will be like
0,0,1,0,0,1,0,0,1,...
what will be a simpler way to create such vector?
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (2)
Sulaymon Eshkabilov
am 14 Aug. 2020
Hi,
O=zeros(1, 20);
m=input('m = ');
IN=m+1:m+1:numel(O);
O(IN)=1;
0 Kommentare
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!