How to grab message from command window and take action in code depending on it.

1 回表示 (過去 30 日間)
How to check command window output and performe action depending on it.
for k = 1:500;
z=z+1;
check(z); %% check.p file checking z and gives output in command window
%% code that should breake the code if command window throws "z is correct"
end
  2 件のコメント
darova
darova 2019 年 10 月 8 日
What command do you want to check?
Arturs Vancans
Arturs Vancans 2019 年 10 月 8 日
I dont want to check anny command check is file name, that brings some output depending on z value

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2019 年 10 月 8 日
I'm almost certain you do not want to do what you asked. It's bizarre. Why not just write a normal program with a GUI or an inputdlg() to ask the user for some input? Or if it was something printed/echoed to the command window by a line of code in your program, just send that line directly to whatever other code needs it.
  6 件のコメント
Arturs Vancans
Arturs Vancans 2019 年 10 月 10 日
I need to determin moment when to turn it off depending on command window output, how to include it in code?
Image Analyst
Image Analyst 2019 年 10 月 12 日
Open the diary file and search for the stopping condition with strfind() or endsWith(). If you find it, turn the diary off. Then since no diary will be continued I guess you'll have to determine somehow in your code when to start logging output to the diary again.

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 10 月 12 日
Use evalc()

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by