How can I get the variable from inside of the for loop and use it /display it after for loop?
이전 댓글 표시
Hi,
I created a for loop. Inside this for loop I calculated a variable. Unfortunately Matlab deletes the variable after the end of the for loop. How can I use the calculated variable outside of the for loop? Thanks!
채택된 답변
추가 답변 (1개)
Sachin Ganjare
2012년 10월 26일
0 개 추천
Declare that variable as global, so that matlab won't delete it.
댓글 수: 4
Sachin Ganjare
2012년 10월 26일
Refer below link:
Simon
2012년 10월 26일
José-Luis
2012년 10월 26일
No it's not. It's a bad idea. Don't use globals. Have the function return the variable instead.
Azzi Abdelmalek
2012년 10월 26일
I don't agree with systematic, it's bad to use globals
카테고리
도움말 센터 및 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!