I have written a Matlab GUI for my C program. I thought about using MEX, but there are too many C files and C program requires a DLL to run.
So, instead I have the Matlab System function calling the executable with inputs, something like [status results] = system('executable "input 1" "input 2"'), which runs well, but I want real time output. results is just a percent output of how complete the program is, and I want to use this output for a GUI progress bar in Matlab.
The output does get stored into results, but only after the program is complete. Thus, making the progress bar pointless.
Is it possible to get the executable to send outputs one at a time to Matlab, and then have Matlab update the progress bar, and return to the executable?
Edit: I’m looking for a solution in Windows.
I found a solution. Credit goes to Richard Alcock at Matlab Central
Specifically, for my solution:
Note: this code does not hold up the executable. The executable must finish before this code finishes, otherwise this code crashes when it gets ahead of the executable.