How to log path to current folder in diary

8 ビュー (過去 30 日間)
Joacim
Joacim 2013 年 10 月 1 日
コメント済み: Joacim 2013 年 10 月 1 日
Is it possible to setup the diary function to log the path to current folder in the diary text file? Both changes made by the user and scripts.
Regards, Jocke

採用された回答

Jan
Jan 2013 年 10 月 1 日
No.
The simplest way would to use a modified cd function, which writes to the command window. But even when cd.m shadows the builtin function, builtin('cd', tempdir) would be undetected.
Using cd is an insecure idea and causes troubles in multi-threading environments. E.g. the callback of a GUI element or a timer could change the current directory during another function runs. Therefore it is recommended to use absolute file names instead, which contain the path. Then there is no need to call CD and displaying the full path names of e.g. imported or exported files to the command window is sufficient and thread-safe.
  1 件のコメント
Joacim
Joacim 2013 年 10 月 1 日
Thanks for your quick answer.

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

その他の回答 (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