How to construct a Row Vector
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
M Salman Rashed
am 14 Okt. 2016
Kommentiert: M Salman Rashed
am 14 Okt. 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 Kommentare
Akzeptierte Antwort
Andrei Bobrov
am 14 Okt. 2016
Bearbeitet: Andrei Bobrov
am 14 Okt. 2016
L = 5; % or L = 1000
out = [zeros(1,L),1,zeros(1,L)];
Siehe auch
Kategorien
Mehr zu Operators and Elementary Operations 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!