Right way to use global variables?
2 次查看(过去 30 天)
显示 更早的评论
Ok, so I know that global variables are tricky and you better not use them. However, for my problem I think I do need them. I connect to a ni session and use a listener to display the data every 2 seconds. Simultaneously this data is written to a file. After about 10 seconds I want to create a new file to deposit the data to. This means that I need to know how many times the listener has been called. I use a global variable to count this, because I believe that the listener doesn't go back to the main file (if that is the right way to say it). So is this a good way to use global variables? Or is there another way? And what is the main concern of using global variables? (code does work by the way)
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!