Diary file with current date and time as time stamp, Part 2

4 views (last 30 days)
To follow up with "Diary file with current date and time as time stamp,"
% Turn On Diary Logging
diary off
% first turn off diary, so as not to log this script
diary_filename=['PVUPAMain',datestr(now,30)];
% setup temp variable with filename + timestamp, echo off
set(0,'DiaryFile',diary_filename)
% set the objectproperty DiaryFile of hObject 0 to the temp variable filename
clear diary_filename
% clean up temp variable
diary on
% turn on diary logging
I would like to define a path to the file. For example, suppose we want to have a file under "C:\" Please advise the next step.

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 1 Jun 2018
Include the full path when you specify the file,
set(0,'DiaryFile',fullfile('c:',diary_filename))
or just use
diary(fullfile('c:',diary_filename))

More Answers (0)

Tags

Products

Community Treasure Hunt

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

Start Hunting!