<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167416</link>
    <title>MATLAB Central Newsreader - timer and gui edit</title>
    <description>Feed for thread: timer and gui edit</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Fri, 11 Apr 2008 20:37:02 -0400</pubDate>
      <title>timer and gui edit</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167416#426162</link>
      <author>Alessandro C.</author>
      <description>Hi all&lt;br&gt;
&lt;br&gt;
This is my code:&lt;br&gt;
&lt;br&gt;
a = 1;&lt;br&gt;
while a == 1&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;t = timer('TimerFcn', 'y = myfunction(x)');&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;start(t)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pause(2)&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
I would like to show the y value in a edit object every 2&lt;br&gt;
seconds. How can I do it?&lt;br&gt;
&lt;br&gt;
Thank you in advance&lt;br&gt;
&lt;br&gt;
Alessandro</description>
    </item>
    <item>
      <pubDate>Sat, 12 Apr 2008 06:21:02 -0400</pubDate>
      <title>Re: timer and gui edit</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167416#426202</link>
      <author>Vihang Patil</author>
      <description>&quot;Alessandro C.&quot; &amp;lt;a.cocciola@gmail.com&amp;gt; wrote in message &lt;br&gt;
&amp;lt;ftoi5e$pm6$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi all&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; This is my code:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; a = 1;&lt;br&gt;
&amp;gt; while a == 1&lt;br&gt;
&amp;gt;     t = timer('TimerFcn', 'y = myfunction(x)');&lt;br&gt;
&amp;gt;     start(t)&lt;br&gt;
&amp;gt;     pause(2)&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I would like to show the y value in a edit object every 2&lt;br&gt;
&amp;gt; seconds. How can I do it?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thank you in advance&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Alessandro&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
Hello&lt;br&gt;
Define your timer function and start the timer in the &lt;br&gt;
gui_openingfcn if you want the timer to start as soon as &lt;br&gt;
the gui is loaded or you can define the timer function in &lt;br&gt;
the gui_openingfcn() but start the timer only say after &lt;br&gt;
the pushbutton is pressed. &lt;br&gt;
You dont need the while loop at all as the timer function &lt;br&gt;
will the job for you. &lt;br&gt;
Try this;&lt;br&gt;
&lt;br&gt;
function main_gui_OpeningFcn(hObject, eventdata, handles, &lt;br&gt;
varargin)&lt;br&gt;
handles.guifig = gcf;&lt;br&gt;
handles.tmr = timer('TimerFcn', &lt;br&gt;
{@TmrFcn,handles.guifig},'BusyMode','Queue',...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'ExecutionMode','FixedRate','Period',2);%timer &lt;br&gt;
updating after every 2 secs&lt;br&gt;
guidata(handles.guifig,handles);&lt;br&gt;
&lt;br&gt;
start(handles.tmr);&lt;br&gt;
guidata(hObject, handles);&lt;br&gt;
&lt;br&gt;
%Timer Function&lt;br&gt;
function TmrFcn(src,event,handles) %Timer function&lt;br&gt;
handles = guidata(handles);&lt;br&gt;
x = myfunction(y);%define your function here &lt;br&gt;
set(handles.edit1,'String',num2str(x)); %assuming x is &lt;br&gt;
type 'double'&lt;br&gt;
guidata(handles.guifig, handles);&lt;br&gt;
&lt;br&gt;
HTH&lt;br&gt;
Vihang</description>
    </item>
    <item>
      <pubDate>Mon, 14 Apr 2008 10:17:01 -0400</pubDate>
      <title>Re: timer and gui edit</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167416#426462</link>
      <author>Alessandro C.</author>
      <description>Thank you very much Vihang!&lt;br&gt;
&lt;br&gt;
Your code works perfectly.&lt;br&gt;
&lt;br&gt;
Thanks again for your time.&lt;br&gt;
&lt;br&gt;
Alessandro</description>
    </item>
    <item>
      <pubDate>Sat, 18 Apr 2009 09:54:01 -0400</pubDate>
      <title>Re: timer and gui edit</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167416#643631</link>
      <author>Jerzy Lapa</author>
      <description>&quot;Vihang Patil&quot; &amp;lt;vihang_patil@yahoo.com&amp;gt; wrote in message &amp;lt;ftpkce$n7r$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Alessandro C.&quot; &amp;lt;a.cocciola@gmail.com&amp;gt; wrote in message &lt;br&gt;
&amp;gt; &amp;lt;ftoi5e$pm6$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Hi all&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; This is my code:&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; a = 1;&lt;br&gt;
&amp;gt; &amp;gt; while a == 1&lt;br&gt;
&amp;gt; &amp;gt;     t = timer('TimerFcn', 'y = myfunction(x)');&lt;br&gt;
&amp;gt; &amp;gt;     start(t)&lt;br&gt;
&amp;gt; &amp;gt;     pause(2)&lt;br&gt;
&amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; I would like to show the y value in a edit object every 2&lt;br&gt;
&amp;gt; &amp;gt; seconds. How can I do it?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thank you in advance&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Alessandro&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Hello&lt;br&gt;
&amp;gt; Define your timer function and start the timer in the &lt;br&gt;
&amp;gt; gui_openingfcn if you want the timer to start as soon as &lt;br&gt;
&amp;gt; the gui is loaded or you can define the timer function in &lt;br&gt;
&amp;gt; the gui_openingfcn() but start the timer only say after &lt;br&gt;
&amp;gt; the pushbutton is pressed. &lt;br&gt;
&amp;gt; You dont need the while loop at all as the timer function &lt;br&gt;
&amp;gt; will the job for you. &lt;br&gt;
&amp;gt; Try this;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; function main_gui_OpeningFcn(hObject, eventdata, handles, &lt;br&gt;
&amp;gt; varargin)&lt;br&gt;
&amp;gt; handles.guifig = gcf;&lt;br&gt;
&amp;gt; handles.tmr = timer('TimerFcn', &lt;br&gt;
&amp;gt; {@TmrFcn,handles.guifig},'BusyMode','Queue',...&lt;br&gt;
&amp;gt;     'ExecutionMode','FixedRate','Period',2);%timer &lt;br&gt;
&amp;gt; updating after every 2 secs&lt;br&gt;
&amp;gt; guidata(handles.guifig,handles);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; start(handles.tmr);&lt;br&gt;
&amp;gt; guidata(hObject, handles);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; %Timer Function&lt;br&gt;
&amp;gt; function TmrFcn(src,event,handles) %Timer function&lt;br&gt;
&amp;gt; handles = guidata(handles);&lt;br&gt;
&amp;gt; x = myfunction(y);%define your function here &lt;br&gt;
&amp;gt; set(handles.edit1,'String',num2str(x)); %assuming x is &lt;br&gt;
&amp;gt; type 'double'&lt;br&gt;
&amp;gt; guidata(handles.guifig, handles);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; HTH&lt;br&gt;
&amp;gt; Vihang&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
Hi, i'm new here.&lt;br&gt;
I must make GUI with timer and yours example works perfectly but only with Edit boxes and I need updating Axes too. In my GUI it opens figure1 in each Timerfcn.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
function TmrFcn(src,event,handles) %Timer function&lt;br&gt;
&lt;br&gt;
handles = guidata(handles);&lt;br&gt;
axes(handles.axes1);&lt;br&gt;
hold off&lt;br&gt;
bar([2,1],'r');&lt;br&gt;
guidata(handles.output, handles);&lt;br&gt;
&lt;br&gt;
what's wrong? i must use set?&lt;br&gt;
&lt;br&gt;
Thx for your help.&lt;br&gt;
Jurek</description>
    </item>
    <item>
      <pubDate>Wed, 09 Feb 2011 03:20:07 -0500</pubDate>
      <title>Re: timer and gui edit</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167416#818199</link>
      <author>Lina Carmen</author>
      <description>Hi,I was going to ask the same question,but I wont after I see your reply.&lt;br&gt;
Its great,thanks.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&quot;Vihang Patil&quot; &amp;lt;vihang_patil@yahoo.com&amp;gt; wrote in message &amp;lt;ftpkce$n7r$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Hello&lt;br&gt;
&amp;gt; Define your timer function and start the timer in the &lt;br&gt;
&amp;gt; gui_openingfcn if you want the timer to start as soon as &lt;br&gt;
&amp;gt; the gui is loaded or you can define the timer function in &lt;br&gt;
&amp;gt; the gui_openingfcn() but start the timer only say after &lt;br&gt;
&amp;gt; the pushbutton is pressed. &lt;br&gt;
&amp;gt; You dont need the while loop at all as the timer function &lt;br&gt;
&amp;gt; will the job for you. &lt;br&gt;
&amp;gt; Try this;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; function main_gui_OpeningFcn(hObject, eventdata, handles, &lt;br&gt;
&amp;gt; varargin)&lt;br&gt;
&amp;gt; handles.guifig = gcf;&lt;br&gt;
&amp;gt; handles.tmr = timer('TimerFcn', &lt;br&gt;
&amp;gt; {@TmrFcn,handles.guifig},'BusyMode','Queue',...</description>
    </item>
  </channel>
</rss>

