Prev: I want to run a function file for every 10 seconds
Next: ??? Subscript indices must either be real positive integers or logicals. Interesting MATLAB loop problem
From: chaitanya on 13 Apr 2010 22:10 Hi all.. I have an function file called"sunposition" that outputs the position of the sun in terms of azimuth & elevation. *imp* The function doesn't need any inputs. I have tried timer function but didn't work. My code looks like this : t=timer; set(t,'executionmode','fixedrate'); set(t,'period',10); set(t,'timerfcn',@sun_position_modified); start(t) when i ran this i got the following error: ??? Error while evaluating TimerFcn for timer 'timer-1' Too many input arguments. I have gone through previous threads that dealt with the same problem, but I didn't understand. Please tell me how to get it running. Thanks!!
From: Walter Roberson on 14 Apr 2010 00:02 chaitanya wrote: > Hi all.. I have an function file called"sunposition" that outputs the > position of the sun in terms of azimuth & elevation. *imp* The function > doesn't need any inputs. I have tried timer function but didn't work. > My code looks like this : > t=timer; > set(t,'executionmode','fixedrate'); > set(t,'period',10); > set(t,'timerfcn',@sun_position_modified); start(t) when i ran this i got > the following error: > ??? Error while evaluating TimerFcn for timer 'timer-1' Too many input > arguments. > I have gone through previous threads that dealt with the same problem, > but I didn't understand. Please tell me how to get it running. Your function sun_position_modified doesn't doesn't need any input arguments for its own operation, but Matlab is automatically trying to pass it a pair of input arguments because Matlab automatically tries to pass two input arguments (at least) to *all* callback routines. After all, Matlab doesn't peak and see "Oh, this routine isn't defined to have any input arguments, so I won't bother to pass them" -- it just goes ahead and passes in the two standard arguments and expects your routines to handle the situation. To fix your problem, change the definition of sun_position_modified to start with function sun_position_modified(src, evt) and then just ignore src and evt if you don't happen to need them.
From: Norbert Kirchgessner on 14 Apr 2010 02:58 "chaitanya " <chaitanya_309(a)yahoo.com> wrote in message <hq36t5$lc$1(a)fred.mathworks.com>... > Hi all.. I have an function file called"sunposition" that outputs the position of the sun in terms of azimuth & elevation. *imp* The function doesn't need any inputs. I have tried timer function but didn't work. My code looks like this : > t=timer; > set(t,'executionmode','fixedrate'); > set(t,'period',10); > set(t,'timerfcn',@sun_position_modified); > start(t) > when i ran this i got the following error: > ??? Error while evaluating TimerFcn for timer 'timer-1' > Too many input arguments. > I have gone through previous threads that dealt with the same problem, but I didn't understand. Please tell me how to get it running. > Thanks!! Hi, how does the declaration of your callback function look like? in the help of timer there is a link to callback functions with an example of a callback declaration in the lower part hth kinor
From: us on 14 Apr 2010 04:22
"chaitanya " <chaitanya_309(a)yahoo.com> wrote in message <hq36t5$lc$1(a)fred.mathworks.com>... > Hi all.. I have an function file called"sunposition" that outputs the position of the sun in terms of azimuth & elevation. *imp* The function doesn't need any inputs. I have tried timer function but didn't work. My code looks like this : > t=timer; > set(t,'executionmode','fixedrate'); > set(t,'period',10); > set(t,'timerfcn',@sun_position_modified); > start(t) > when i ran this i got the following error: > ??? Error while evaluating TimerFcn for timer 'timer-1' > Too many input arguments. > I have gone through previous threads that dealt with the same problem, but I didn't understand. Please tell me how to get it running. > Thanks!! a hint: - this is a typical syntax problem... http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f9-39541.html#f9-39598 us |