I converted my matlab program to a standalone exe. When I call the exe from the command line it does not wait till the exe is executed. The program takes about 20-30sec to run. The program basically creates a txt file. How can I make it to wait until the exe is executed. My matlab main function is

function []=features(img_path,category,output_path)
if (strcmp('shoe',category)== 1)
    if exist(img_path,'file')
     test_shoes(img_path,output_path);            
    else
        disp ('Input image path does not exist');
    end     
else
    disp('Sorry wrong input for category.Please give shoe/dress/handbag');

end
return;

The problem is shown in the below screenshot:

The "All warnings have the state 'off'." is actually displayed by the exe from MATLAB afer 5 sec but the terminal does not wait until the exe is finished executing i.e "E:\test>" is already shown in the next line immediately after calling the exe.

How can I make the commandline wait until the exe os finished executing so that the new command line does not appear until its finished??

有帮助吗?

解决方案

You could try to run it like this:

START /WAIT MyProgramm.exe

take a look here:

how-do-you-wait-for-an-exe-to-complete-in-batch-file

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top