Run Code in GUI matlab every setup time given by user

4 views (last 30 days)
I have written code that found the result that i need , after i pushed the button in my GUI , my question is how we can set a timer for example its take the time from my computer and every 2 or 3 hours its rerun that code and find the result , this time must appear in text box and the number of running also if possible appear in other text box , for example
if open my GUI matlab program and running code then i press the autotime push bottom after i set 2 hourse as autotime then after 2 hourse that code must run and the number of running must appear 2 and then 3 till i close my GUI program .. please an suggestion can help me ..
this is my example code which can write the names of content of folder (test) in an excel table , and this content may every 1 or 2 hours are changed or deleted based on user modified then its write the current result.
filename = 'D:\result.xls'; %The name of your xls file
sheet = 'Sheet1';
column = 'B'; % Initialisation of the column range
column_header = strcat(column , '1');
srcFolders = dir('D:\test\*.*');
for folder = 1:length(srcFolders)
path = strcat('D:\test',srcFolders(folder).name);
xlswrite(filename,{srcFolders(folder).name}, sheet, column_header);
column = char(column + 1); %Moving to the next column

Accepted Answer

Shashikiran Rajashekar
Shashikiran Rajashekar on 8 Sep 2015
you can use "timer" present in matlab it will the execute the attached call back function after the time has elasped

More Answers (0)

Community Treasure Hunt

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

Start Hunting!