Log Warnings from Command Window.

6 ビュー (過去 30 日間)
Swadhin
Swadhin 2024 年 12 月 23 日
回答済み: Gayathri 2024 年 12 月 24 日
While simulating a model I receive a lot of warnings for undefined units, signal atributes and other.
I want to remove these all warning from my command window and store them into a text file.
I tried using warning('off','all') but this only removes them from command windpow.
if i use diary then also the warnings should be in my command window then only it makes the text file.

回答 (1 件)

Gayathri
Gayathri 2024 年 12 月 24 日
One way to write the warnings to a text file is using the "evalc" function. You can use the command as follows.
logs=evalc("sim(load_system('model.slx'));")
This command would capture the warnings and errors into "logs" which is of type 'char'. Then the contents of 'log' can be written to a '.txt' file. You can utilize the "evalc" function and apply it according to your requirements.
The output of the above command would look as follows.
For more information about the "evalc" function, please run the following in the command window.
doc evalc
Hope this helps!

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by