run matlab script as bat input arguments

2 views (last 30 days)
WEI LIN
WEI LIN on 14 Mar 2017
Edited: WEI LIN on 14 Mar 2017
Hi,
I use "dos" to run a bat file(my.bat) from matlab and the bat file will open a tcl shell and waiting for user keyboard inputs. After I run %%section1, the matlab console will switch to tcl console and waiting for user inputs, then, I run %%section2, those tcl_shell_command will be treats as user keyboard inputs of my.bat and be successfully passed to the tcl shell. This is the case when I run matlab code separately(I select the section I want to run, and press F9: evaluate selection).
However, if I run the all matlab code at once(press "run" button), the program will suspend and wait for user input after dos('my.bat'), and not take the matlab code in %%section2 as input arguments of my.bat.
I am wondering why the matlab doesn't take the code in %%section2 as keyboard input arguments of my.bat when I run the whole program at once. What is the difference b/w using "F9" to separately run the code and use "run" to run the who program at once? What is the correct way to implement it if I want the my.bat directly take the matlab code as user inputs after dos(my.bat)?
%%section1
dos('my.bat');
%%section2
tcl_shell_command_1; tcl_shell_command_2; tcl_shell_command_3;
Many thanks!!!

Answers (0)

Categories

Find more on Debugging and Analysis 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!