Right way to use global variables?

2 visualizaciones (últimos 30 días)
Anne
Anne el 6 de Nov. de 2013
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)

Respuestas (0)

Categorías

Más información sobre Variables en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by