MATLAB: Respond to text commands in command window without prompting for it

inputMATLABwhile loop

I am trying to create a script that i will turn into a windows executable and run in the background on a test rig.
I am setting it up to do 'something' every 12 hours, however i also want it to do that 'something' now if it sees a certain combination of text in the command window. I can't figure out how to get my loop to continue looping while also looking for an input command. The problem is if i use the input function the script will just sit and wait for me to enter an input and not continue looping until i do.
Is there a way to call the input function with parameters that will cause it to timeout if no input has been entered within some period of time?
here is some pseudocode
reference_string = 'scan';
timer = 0;
while 1
str_in = input('','s');
if isempty(str_in)
str_in = '0';
end
if str_in == reference_string
%do something
elseif timer >= 12hr
timer = 0;
%do soemthing
else
%continue looping
end
timer++;
end

Best Answer

I have two suggestions:
I don't really see how you would put that functionality in a CLI, so I'm going to suggest another route: the callback of the 'edit' style uicontrol element.
On the other hand, you could also use a timer object to schedule a task for 12 hours, and also keep the interface open for manually triggered tasks.
Related Question