필터 지우기
필터 지우기

for loop in case of squre bracket in matlab

조회 수: 3 (최근 30일)
Safi ullah
Safi ullah 2017년 2월 22일
답변: Image Analyst 2017년 2월 24일
I studied a code related to my work in which there used a for loop.as given
for jcyc=3:3:57;
[ddx, cycl_ind(jcyc)]=min(abs(jcyc-time_2));
end
here time_2=1×1800.in square bracket the function of ddx and cycl_ind(jcyc) is not clear to me.I mean on the left side for which purpose the square bracket and inside it ddx, cycl_ind(jcyc) is used.?
  댓글 수: 2
Stephen23
Stephen23 2017년 2월 22일
@ SAFI ULLAH: you are asking questions that are very basic MATLAB syntax. These topics are covered very well in the introductory tutorials:
Safi ullah
Safi ullah 2017년 2월 24일
@Stephen Cobeldick thanks I studied the link and it is helpful for me

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

채택된 답변

Image Analyst
Image Analyst 2017년 2월 24일
min() returns, or can return two outputs. If you accept more than one of the outputs, you need to group all the outputs together with brackets, otherwise it would be interpreted as two separate lines of code on the same line (you can put multiple commands on the same line if you separate them with commas).
The documentation says the first variable is the min value, and the second variable is the index where the min occurs.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by