필터 지우기
필터 지우기

Use for loop in array

조회 수: 1 (최근 30일)
hang dong
hang dong 2019년 6월 10일
댓글: KSSV 2019년 6월 10일
How to use the for loop in array with a start value of 0?

답변 (1개)

KSSV
KSSV 2019년 6월 10일
a = rand(10,1) ;
for i = 1:length(a)
a(i)
end
  댓글 수: 6
hang dong
hang dong 2019년 6월 10일
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 2019년 6월 10일
You can get the index of 0 using
idx = find(a==0)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by