Using variable in a loop outside the loop
Mostrar comentarios más antiguos
I am getting real time data every 5seconds (with pause) with a loop and the data goes into matrix. How can I use the current data outside the loop and proceed to do computation with the most current data (the first row in the matrix)? When the loop is running I can not do anything until it is finished.. And I need to create infinite loop to continuously get the data.
1 comentario
Dhenish
el 8 de Dic. de 2023
I have also this type of requirement so can you give me guidelines for this.
I also want variables value after every itration. i just want to change the value of varibales which is changing dynamiclly in every 5 seconds and need to store that variables in the base workspace.
Thanks in advance!!
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 16 de Mayo de 2015
0 votos
Pretty much all of the data reception methods allow you to set a callback when data is ready (though if you are using the session-based interface on the DAQ and are waiting for a Trigger, then you might have to add a listener.) You would configure the data reception to trigger the callback every time the data was ready, and in the callback you would receive the data and store it away in a known location.
Meanwhile in your data processing loop, you would check once per loop to see if new data was received, and you would update your matrices if so.
1 comentario
Categorías
Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!