How to run 2 scrips simultaneously, one for sending output to lab equipment and one for reading sensor output.

2 views (last 30 days)
I have a test testup which consists of a shaker with a mechanism mounted on it, and two laser sensors which measure their relative distance to two points on the mechanism.
I'm trying to run two scripts simultaneously to control my test setup and read the sensor output.
The first one is for sending out a sine wave to a shaker and the second one is for reading the sensor output of the two sensors.
Both scrips are automatically generated scripts made from the analog output generator and the analog input recorder.
What would be the easiest way to get these scripts to run at the same time.
I'm using Matlab 2020b

Answers (1)

Jon
Jon on 23 Sep 2020
Edited: Jon on 23 Sep 2020
I'm not sure about licensing restrictions, but in Windows (probably similar for other OS) you can right click on the MATLAB icon and open a second instance of MATLAB. Then you can run one script in one instance and the other in the second instance.
You could also use two timer functions with appropriate callback functions to interleave the operation. MATLAB is essentially single threaded though so it may not be exactly what you want.

Categories

Find more on Periodic Waveform Generation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!