Command line does not wait until the exe execution is finished
Asked Answered
G

1

6

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??

Golda answered 29/8, 2013 at 10:53 Comment(0)
P
22

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

Proscribe answered 29/8, 2013 at 11:27 Comment(2)
is there any way I can encorporate something in the code itself so that I should not type START /WAIT everytime I call the exe?Golda
You could use a Batch-file!Proscribe

© 2022 - 2024 — McMap. All rights reserved.