I am trying to read data from a Bluetooth device. I have code which works perfectly fine in MATLAB. But when I was reading the data in MATLAB, current MATLAB session remained busy till the data was read. However, I wanted to acquire this data in parallel, so I decided to use "parfeval" to read data on a different worker. I am creating Bluetooth object and using "fopen" to open Bluetooth connection in MATLAB. I have a call back function which will be used in "parfeval", this function accepts this Bluetooth object and reads data from Bluetooth device. However, when I call this function using "parfeval", I get an error saying:
Error using parallel.FevalFuture/fetchOutputs (line 147)
One or more futures resulted in an error.
Error in parallelProcessingTest (line 61)
val = fetchOutputs(f)
Cause by:
Error using icinterface/fscanf (line 208)
| OBJ must be connected to the hardware with FOPEN.|
Since, this function was working correctly when I was not using "parfeval", I believe the issue is because of "parfeval". How can I collect Bluetooth data in callback function using "parfeval"?
Best Answer