Running two functions at the same time

Hello, I am developing a project that requires octave to send information to an arduino and at the same time, plot a graph in an interface. Is there any way I can do these tasks simultaneously? I am reading some things about the package Parallel, but I don’t think I can use it, from what I understand. It would have to be something like matlabpool, is there any way to replicate that in Octave?
Thank you.

Is “poor man’s parallelism” (i.e. starting two Octave instances for each task) an option for your problem?

well, not really, unless there is a way to open and run it through octave code, which I don’t think there is…

Can you give more information on your problem. Maybe a concrete example about the steps and the order in which you like to perform them.

Is the data sent to the arduino related to what has to be plottet? And what does


So, basically I am developing a simulator that creates a signal and sends it to a digital pwm pin in arduino through arduino package, with writePWMVoltage.
At the same time I wanted to draw the signal in a plot, that is located in a GUI user interface.
I am able to do both taks, I just can’t do them at the same time. They are different functions, and don’t rely on eachother.
The poor man’s parallelism does work, but not for what I intend to do.

Thanks for the explanation. I still need to know (never really used that package and no Arduino expert :innocent: ) if you call @arduino/writePWMVoltage.m (which internally calls
@arduino/writePWMDutyCycle.m) only once and Octave is “blocked” with this task, or if you call this function periodically.

In the first case, I suggest to copy the code of both functions into a custom own function and insert the plot command at a convenient location.

In the latter case of periodical calls, wan’t it possible to interleave @arduino/writePWMVoltage.m and plot commands using hold on;? I think this is what @octavecontrib wanted to suggest, but the post was withdrawn. Is there an obvious reason why this will not work?

1 Like