Borrar filtros
Borrar filtros

Check if the programm is running already

33 visualizaciones (últimos 30 días)
Vitali Walter
Vitali Walter el 8 de Oct. de 2017
Respondida: Manish Annappa el 11 de Oct. de 2017
Hello.
I wrote a programm for the app designer which is running after pressing the start button. The program starts a session with the aquisition toolbox.The problem is, when I press the button afterwards again it gives me back an arror because of the session that has already started before. So I need a peace of code, wich will check if the session is already running.
Unfortanly I have no clu how I can do it. I was thinking abaout if-else: If true, dont start again, else run the program. Could anyone give me some hints how to do it?
Thx

Respuestas (1)

Manish Annappa
Manish Annappa el 11 de Oct. de 2017
There is a property called 'IsRunning' on the session object that can be used to check if the current session is active.
Note: However, this will work only if you are not clearing the work space or deleting the previous session object before 'Start' button click.
Here are a couple of other ways to achieve it.
1) Have a Stop button that will call a callback function which releases the current session by calling 'release' on the session object. Refer to the below link for more information on the 'release' function.
So, everytime click the 'Start' button after clicking 'Stop' button.
2) Calling 'daqreset' before creating the session in 'Start' button handler will make sure that all the current sessions are released.

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by