Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

matlab low priority system call

Tags:

windows

matlab

I want to check/improve some correction algorithm I use.

The whole thing is implemented in Matlab and goes something like this

for ii = 1:nn
   ... % Prepare some input files
   parfor i = 1:n
      system('...'); % simulation code
   end
   ... % Use the output and prepare some stuff that can be used to prep the next iteration
end

Wherey n is a bigger number than the #Treads I can use. This normaly takes a while to run and in the meantime I would like to use the computer for other (non cpu hungry) tasks. Therefore I would like to run the system calls with low priority.

I already tried to do this using new or start but then the call doesn't wait till it's finished and just proceeds. There would be a dirty hack over checking if the output files exist, but then again I was asking myself if there was not a better solution for that...

Any help would be greatly appreciated

yours magu_

like image 343
magu_ Avatar asked Jul 31 '26 14:07

magu_


1 Answers

try using the /wait flag in start command:

>> system( 'start /LOW /WAIT matlab.exe' );

started a new matlab instance and resumed execution only after I closed the opened application.

Of course, you need to replace matlab.exe in my proposed solution with the simulation program name you want to run.

like image 103
Shai Avatar answered Aug 03 '26 07:08

Shai



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!