diary, how to create a new one

12 ビュー (過去 30 日間)
Lizan
Lizan 2014 年 10 月 16 日
回答済み: Dave 2017 年 11 月 9 日
I have a .m file I want to save the text at the command window. Next time I run the m-file I want to create a new diary file. This however seem to be problematic. I try to save the diary with a new filename but I get the message that the file doesn't exist.
Any idea how to solve this?

採用された回答

Mohammad Abouali
Mohammad Abouali 2014 年 10 月 16 日
編集済み: Mohammad Abouali 2014 年 10 月 16 日
could you paste the value for savdir and ['file_',mfilename,myFolder(53:end),'diary.txt']?
also execute fullfile(savdir,['file_',mfilename,myFolder(53:end),'diary.txt']) and check if that runs ok.

その他の回答 (2 件)

Dave
Dave 2017 年 11 月 9 日
Automatic date and time append:
diary(['diary_',datestr(now,'dd-mm-yy','local'),'_',datestr(now,'hh-MM-ss','local'),'.txt'])

Sean de Wolski
Sean de Wolski 2014 年 10 月 16 日
  2 件のコメント
Lizan
Lizan 2014 年 10 月 16 日
編集済み: Lizan 2014 年 10 月 16 日
This doesn't work for me. I get "file not found." error My code is;
Error in myfile (line 25)
diary(fullfile(savdir,['file_',mfilename,myFolder(53:end),'diary.txt']))
Sean de Wolski
Sean de Wolski 2014 年 10 月 16 日
Well I have no clue what those variables are do I don't know what it means. What happens if you put a breakpoint on that line and print the output from fullfile

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

カテゴリ

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