for loop reference solution (from coursera) question

조회 수: 4 (최근 30일)
Sara Ismail-Sutton
Sara Ismail-Sutton 2021년 3월 14일
답변: Shubham Rawat 2021년 3월 17일
Sorry if this is a stupid question, but I am pretty new to matlab, looking at this solution at the loop "for n=1:nint@" I can't see how this works as there isn't a variable allocated "n", just "nx" and "ny". and the other functions in the loop are functions of 'Z' or 'z'.
Many thanks for your help.
  댓글 수: 1
Russel Burgess
Russel Burgess 2021년 3월 14일
The for loop expression creates the variable, i.e.,
for n=1:nit
Will create a variable, n, initially set to 1. n is persistent, i.e., it will still exist after the foor loop is done - with the value nit, assuming nothing caused the for loop to break out early.

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

답변 (1개)

Shubham Rawat
Shubham Rawat 2021년 3월 17일
Hi Sara,
Comment is correct only inside for loop the variable n is instantiated.
You may look into this documentation for further help:
Hope this Helps!

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by