Filter löschen
Filter löschen

Use for loop in array

1 Ansicht (letzte 30 Tage)
hang dong
hang dong am 10 Jun. 2019
Kommentiert: KSSV am 10 Jun. 2019
How to use the for loop in array with a start value of 0?

Antworten (1)

KSSV
KSSV am 10 Jun. 2019
a = rand(10,1) ;
for i = 1:length(a)
a(i)
end
  6 Kommentare
hang dong
hang dong am 10 Jun. 2019
I want to create an array of n elements, then programmatically to swap values ​​in that S array, in the array containing element 0
KSSV
KSSV am 10 Jun. 2019
You can get the index of 0 using
idx = find(a==0)

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Loops and Conditional Statements 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!

Translated by