You are on page 1of 2

[matlab]

April 15, 2012

THE USE OF MATLAB TIMER TO SEND TEXT

Okay, this is not so important article actually. The idea behind this text is the possibility to use TIMER Matlab Function to help on shceduling. I choose sending text scheduling as case to solve. This program might be able to be extended into other great applications. We dont need any complex instruction here and no need to learn kind of math algorithm.. To make it simple, lets move on to first case where I consider to make a clock displayed on matlab window. Here is the codes:
function myclock() % make timer with periode 1 second wkt = timer('period',1.0); set(wkt,'ExecutionMode','fixedrate','StartDelay',0.5); set(wkt,'timerfcn',['clc;',... 'tk=datestr(clock,''mmm.dd,yyyy HH:MM:SS'');',... 'disp(''Current Time'');',... 'disp(tk)']); start(wkt);

when executed, it displays formatted current time:

And for the sending text codes, here it is


function mydatatimer() wkt = timer('period',10); set(wkt,'ExecutionMode','fixedrate','StartDelay',0.5); set(wkt,'timerfcn',['fID = fopen(''coba.txt'',''a+'');',... 'fprintf(fID,''texting to you'');',... 'fclose(fID);',... 'disp(''texting to you'');']); start(wkt);

janshendry@gmail.com

Page 1

[matlab]

April 15, 2012

well, actually i have tried some smart way to make the codes. I mean by creating a function that contains important codes or codes that will be run by the timer function. But when i tried to call this function from timer function, it did not work. So I use this stupid way to make it works... funny you Matlab... By the way, here is the result when last program executed.

Okay, we can use other application instead of notepad such as Excel as long as matlab has its support. I hope you guys can do better than this, and make extend application based on above programs.

@ thanks

janshendry@gmail.com

Page 2

You might also like