%% xfoil_wait.m % Input node number and run time. Function will wait for XFOIL % to complete. If it does not complete within "time", it will % automatically terminate XFOIL. If XFOIL completed on its own, return 1. % If XFOIL timed out and required to be terminated, return 0. function ret = xfoil_wait(cpu,time,run) tic; % switch run % case 1 % !color 07 & % case 2 % !color 81 & % case 3 % !color 17 & % case 4 % !color 50 & % case 5 % !color 47 & % end xfoil_pid = scan_pid(cpu,'xfoilP4.exe'); %dos(['SetPriority -t-2 ',num2str(xfoil_pid),' > priority.output']); while (toc) < time clear xfoil_pid xfoil_pid = scan_pid(cpu,'xfoilP4.exe'); if ~xfoil_pid,break,end pause(5); end kill(scan_pid(cpu,'cmd.exe')) if ~xfoil_pid ret = 1; else kill(xfoil_pid) ret = 0; end