1) Given the following MATLAB for loop: for a= 1:6 b=a*3; end What is the value of b upon completion of the loop?
조회 수: 4 (최근 30일)
이전 댓글 표시
1) Given the following MATLAB for loop:
for a= 1:6
b=a*3;
end
What is the value of b upon completion of the loop?
2) Given the following MATLAB for loop:
for a= 1:6
b=a*3;
end
Once the loop has completed, what is the value of a?
댓글 수: 1
James Tursa
2015년 3월 26일
편집: James Tursa
2015년 3월 26일
Seriously, it would be less effort to simply copy and paste that loop into MATLAB than to create this Question. Just do it and see what the result is.
답변 (1개)
James Tursa
2015년 3월 26일
- Highlight all three lines of the for loop
- Press Ctrl-C
- Click on the MATLAB command window (the one with the >> showing)
- Press Ctrl-V
- Examine the values of a and b
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!