Clear Filters
Clear Filters

Detect from matlab whether other programs are not responding [SOLVED]

6 views (last 30 days)
I'd like to share something I couldn't find a straightforward answer to by googling.
I use a program outside matlab to make some calculations. I write the code for the program in matlab, load it outside matlab, and then interact with the program's GUI for it to run. finally I import the calculated outputs. Loading the files in the program commonly puts it in "not responding" mode for few seconds and I'd like to interact with the GUI when it comes back to life.
To detect wether it's not responding I use:
[~,result] = system('tasklist /fi "status eq not responding" /fi "Imagename eq phreeqci.exe" /nh');
where "phreeqci.exe" is my program (as presented in Tasklist or Task Manager). "result" will give a line with details about the program if it is in fact non-responsive and the warning:
INFO: No tasks are running which match the specified criteria.
if it is responsive.
waiting for it to respond looks like this:
status=0;
while status==0
[~,result] = system('tasklist /fi "status eq not responding" /fi "Imagename eq phreeqci.exe" /nh');
status=strcmp(result,[['INFO: No tasks are running which match the specified criteria.' char(10) '']]);
end
fprintf('Responsive!\n')
I was not familiar with using the command line and this link helped me: https://technet.microsoft.com/en-us/library/bb491010.aspx
Hope this would help someone out there.

Answers (0)

Categories

Find more on Develop Apps Using App Designer 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!