Call a Matlab function

1 visualización (últimos 30 días)
ANUBHAV SINHA
ANUBHAV SINHA el 28 de Mzo. de 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.

Respuesta aceptada

David Young
David Young el 28 de Mzo. de 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.

Más respuestas (0)

Categorías

Más información sobre Get Started with GPU Coder en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by