Array operation shift values
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Ali Mukhtar
il 18 Mar 2021
Commentato: Walter Roberson
il 18 Mar 2021
i have an array of A=[0 0 0 0 0 ] im sending first value "3" array become A=[3 0 0 0 0] ... then when i send next value for e.g. "5" then array should be A=[5 3 0 0 0] and then if "1" A=[ 1 5 3 0 0] . i cant identify command for this purpose
0 Commenti
Risposta accettata
Più risposte (1)
Walter Roberson
il 18 Mar 2021
A = zeros(1,5);
for K = [3 5 1]
A = [K, A(1:end-1)]
end
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!