Rank: 4904 based on 2 downloads (last 30 days) and 2 files submitted
photo

SamGhim

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Files Posted by SamGhim View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
23 Nov 2009 Write text file write_txt_file - creates a .txt file with desired information as specified by "info_str) Author: SamGhim text file 2 1
23 Nov 2009 current_date prints out current date and time. Author: SamGhim date, time, clock 0 3
  • 1.0
1.0 | 2 ratings
Comments and Ratings on SamGhim's Files View all
Updated File Comment by Comments Rating
17 Jan 2010 current_date prints out current date and time. Author: SamGhim Simon, Jan

Jos found a bug, which is caused by using "mn" as name of the variables for minutes and month. The bug has not been fixed for 8 weeks.
Although I appreciate that you write programs just for fun, the real fun for publishing functions in the FEX start, if the functions are working and if others can use them. Please update or remove this function.
Thanks.

25 Nov 2009 current_date prints out current date and time. Author: SamGhim Jos (10584)

Do no rely on this when you have to be on time ...
>> [d,t] = current_date
% d = 2009\11\25
% t =10:11:54
>> datestr(now)
ans = 25-Nov-2009 10:49:07

This trivial submission might have only some educational value, but than it should 1) work correctly; 2) have a lot of (edcucational) comments; and 3) a superior help section

I would recommend anyone to use DATESTR.

24 Nov 2009 current_date prints out current date and time. Author: SamGhim Simon, Jan

Rounding the seconds is not correct: 59.6 sec should not be displayed as 60! Better use FIX.
Instead of NUM2STR and adding a leading '0', you can call SPRINTF('%.2d', hr) to get 2 digits. This can be combined:
  full_date = clock;
  date = sprintf('%.4d/%.2d/%.2d', full_date(1:3));
  time = sprintf('%.2d:%.2d:%.2d', fix(full_date(4:6)));

Have you seen DATESTR?

24 Nov 2009 Write text file write_txt_file - creates a .txt file with desired information as specified by "info_str) Author: SamGhim Simon, Jan

file = strcat(logpath,'\',filename)
can be improved:
file = fullfile(logpath, filename);
This considers a trailing file separator in the path and different separator for Unix and Windos.

if exist(file), fid = fopen(file,'at');
else, fid = fopen(file,'wt'); end
EXIST(Key) without specifying the type is very slow, because it tests for files, folders, variables, classes, ... Better use "exist(file, 'file')" -- but even better: omit the EXIST and use "fopen(file, 'at+')".

Top Tags Applied by SamGhim
clock, date, text file, time
Files Tagged by SamGhim View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
23 Nov 2009 Write text file write_txt_file - creates a .txt file with desired information as specified by "info_str) Author: SamGhim text file 2 1
23 Nov 2009 current_date prints out current date and time. Author: SamGhim date, time, clock 0 3
  • 1.0
1.0 | 2 ratings

Contact us at files@mathworks.com