Call a Matlab function

1 view (last 30 days)
ANUBHAV SINHA
ANUBHAV SINHA on 28 Mar 2012
I have developed a controller that monitors the data for 24 hours. Hence I want to run it continuously for hours.
The method I think to use is to write the code in a function and call the function through a infinite while loop.
My question: 1) How to call a function in MATLAB having no input or output arguments. The infinite while loop would simply call the function to execute it. What is the syntax??
2) Is there any better way to run programs for a indefinite period which control some hardware systems.
Thanks.

Accepted Answer

David Young
David Young on 28 Mar 2012
while 1
your_function();
end
The () is not necessary as there are no arguments, but I think they make the code easier to read.
There may be a better way, but it depends on the hardware. For example you might associate the function with a timer (see doc timer), or with a hardware interrupt.

More Answers (0)

Categories

Find more on Get Started with GPU Coder in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!