Call a Matlab function

2 次查看(过去 30 天)
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.

采纳的回答

David Young
David Young 2012-3-28
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Whos 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by