Access variables in parallel computing
Mostra commenti meno recenti
Hello everyone,
I have a problem that I'm unsure how to solve:
I have a video camera recording during a task that gives a TTL signal per frame (approx 75 Hz) that I would like to count in the background while the main task is running. However to synchronize the signals I would like MATLAB to access the counter variable at certain points during the task and return the frame number. I have tried using the parallel computing toolbox, however I do not know how to access the counter variable in the background. Is there any way of doing this on one machine or how could this be best achieved?
Thanks in advance for the help,
John
3 Commenti
Raymond Norris
il 5 Apr 2022
You want a background task to count TTL signals from a video camera recording. You want the main task to poke the background task everyone once and while to get the current frame number. More specifically, you don't want the background task to "broadcast" out the current frame to the main task -- the main task will ask for it when it needs it. Is that all correct?
In a moment in time, if the main task asks for the current frame number, by the time the background task receives the request, there current frame number could have changed several times. Or how close to real time does this have to be?
Do you have the Parallel Computing Toolbox? Which version of MATLAB are you running?
John Tuff
il 5 Apr 2022
Alice
il 18 Giu 2024
Hi,
A bit late, but I have the same question : I need to access a variable in my main program that is being modified in the background. I can access it sometimes but it will stop updating the variable after some time and give me a constant value when the actual variable is changing, so I think that I'm not going about it the right way.
How did you solve your problem?
Thanks in advance,
Alice
Risposte (2)
Steven Lord
il 4 Apr 2022
0 voti
2 Commenti
John Tuff
il 4 Apr 2022
Steven Lord
il 4 Apr 2022
Doesn't this paragraph from the documentation page address that?
"Use parfeval with the background pool to run a function in the background. parfeval immediately returns a Future object that represents the function running in the background. To get results from the Future, call fetchOutputs."
John Tuff
il 5 Apr 2022
Categorie
Scopri di più su Parallel Computing Toolbox in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!