How to construct a Row Vector
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
M Salman Rashed
il 14 Ott 2016
Commentato: M Salman Rashed
il 14 Ott 2016
I want to construct a row vector, with say, "L zeros", followed by a "1", and then again followed by "L Zeros"
What is the easiest command to do that? For example a= [ (0 0 0 ... L-1(0)) 1 (0 0 0 ... (L-1) 0)]
0 Commenti
Risposta accettata
Andrei Bobrov
il 14 Ott 2016
Modificato: Andrei Bobrov
il 14 Ott 2016
L = 5; % or L = 1000
out = [zeros(1,L),1,zeros(1,L)];
Vedere anche
Categorie
Scopri di più su Operators and Elementary Operations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!