how to override a diary command if another diary already exists?

8 ビュー (過去 30 日間)
zepp
zepp 2014 年 6 月 27 日
回答済み: Geoff Hayes 2014 年 6 月 27 日
I usually create a log file at the start of each session by adding it to startup.m. Now, I'm trying to run a piece of code that maintains a local log by creating another diary. Once this second diary is created, my global diary loses its logging capabilities.
Is there a way I can override a new diary creation if another diary file already exists?

採用された回答

Geoff Hayes
Geoff Hayes 2014 年 6 月 27 日
You can check the status of the diary with the following code
diaryStatus = get(0,'Diary');
The diaryStatus will be the string 'on' if a diary has already been started to log keyboard input. If the status is 'off' then there is no existing diary and a new one can be started. See http://www.mathworks.com/help/matlab/ref/diary.html for details.
Hope the helps!

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by