How can I get the variable from inside of the for loop and use it /display it after for loop?
Ältere Kommentare anzeigen
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 Kommentar
Azzi Abdelmalek
am 26 Okt. 2012
post your code
Akzeptierte Antwort
Weitere Antworten (1)
Sachin Ganjare
am 26 Okt. 2012
0 Stimmen
Declare that variable as global, so that matlab won't delete it.
4 Kommentare
Sachin Ganjare
am 26 Okt. 2012
Refer below link:
Simon
am 26 Okt. 2012
José-Luis
am 26 Okt. 2012
No it's not. It's a bad idea. Don't use globals. Have the function return the variable instead.
Azzi Abdelmalek
am 26 Okt. 2012
I don't agree with systematic, it's bad to use globals
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!