sldiagviewer.diary
診断メッセージおよびビルド情報のログをファイルに記録する
構文
説明
sldiagviewer.diary
は、現在のフォルダー内のテキスト ファイル diary.txt
に、警告、エラー、およびビルド情報のログを記録します。
例
ファイルへの診断メッセージのログ記録
sldiagviewer.diary
を使用して、モデルのシミュレーションの警告およびエラーのログをテキスト ファイルに記録します。
ログ ファイル diary.txt
を作成し、ログ記録をオンにします。
sldiagviewer.diary
モデル DiagnosticDemo
を読み込みます。
model = "DiagnosticDemo";
load_system(model);
モデルにエラーを導入します。
set_param("DiagnosticDemo/Gain","Gain","xyz")
モデル DiagnosticDemo
のシミュレーションを実行します。
set_param(model,"SimulationCommand","Start")
エラーのログが diary
.txt
に記録されます。
特定のファイルへの診断メッセージのログ記録
sldiagviewer.diary
を使用して、モデルのシミュレーションの警告およびエラーのログを指定したテキスト ファイルに記録します。
ログ ファイル mySimulationDiary.txt
を作成し、ログ記録をオンにします。
sldiagviewer.diary('mySimulationDiary.txt')
モデル DiagnosticDemo
を読み込みます。
model = "DiagnosticDemo";
load_system(model);
モデルにエラーを導入します。
set_param("DiagnosticDemo/Gain","Gain","xyz")
モデル DiagnosticDemo
のシミュレーションを実行します。
set_param(model,"SimulationCommand","Start")
エラーのログが mySimulationDiary.txt
に記録されます。
ファイルのログ状態の切り替え
sldiagviewer.diary
を使用してファイルでログを作成し、ログ状態を切り替えます。
ログ ファイル diary.txt
を作成し、ログ記録をオンにします。
sldiagviewer.diary
モデル DiagnosticDemo
を読み込みます。
model = "DiagnosticDemo";
open_system(model);
モデルにエラーを導入します。
set_param("DiagnosticDemo/Gain","Gain","xyz");
モデルのシミュレーションを実行します。
set_param(model,"SimulationCommand","Start")
エラーのログが diary.txt
に記録されます。
モデルにエラーを再度導入します。
set_param("DiagnosticDemo/Gain","Gain","abc");
ログ記録をオフにします。
sldiagviewer.diary("off")
モデルのシミュレーションを実行します。
set_param(model,"SimulationCommand","Start")
エラーのログは diary.txt
に記録されません。
ログ ファイルの文字エンコードの指定
UTF-8 エンコードを使用して、モデルのシミュレーションの警告およびエラーのログを指定したテキスト ファイルに記録します。
ログ ファイル mySimulationDiary.txt
を作成し、文字エンコードを UTF-8 に設定します。
sldiagviewer.diary("mySimulationDiary.txt","UTF-8")
モデル DiagnosticDemo を読み込みます。
model = "DiagnosticDemo";
load_system(model);
モデルにエラーを導入します。
set_param("DiagnosticDemo/Gain","Gain","xyz")
モデル DiagnosticDemo をシミュレートします。
set_param(model,"SimulationCommand","Start")
エラーのログが mySimulationDiary.txt
に記録されます。
入力引数
filename
— ログ ファイルの名前
string スカラー | 文字ベクトル
ログ ファイルの名前。string スカラーまたは文字ベクトルとして指定します。
例: "mySimulationDiary.txt"
例: "C:\MyLogs\logDiary.txt"
toggle
— ログ状態
"on"
| "off"
ログ状態。"on"
または "off"
として指定します。
バージョン履歴
R2014a で導入
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)