ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

State machine with array

Hi, 

 

       I had a question wrt state machine. Is it possible to make a statemachine with for loop as an array numerical input for max and min operation? How to create the same operation with array input in case of while loop?

0 Kudos
Message 1 of 13
(4,858 Views)

You should specify more the details, what is your goal with this?

What about min/max operations? There is a min/max function for arrays, you do not need to index it out...

 

edit: and why you mention state machine? State machine is one thing, array manipulation is another thing...

edit: or your qestion is about that, you want to make a state machine using a FOR loop instead of a WHILE loop? Why?

0 Kudos
Message 2 of 13
(4,838 Views)

Duplicate thread



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 13
(4,829 Views)

Hi,

 

          I have analog in signal from a daq device, these are array of signals. I have a limit for each signal, so i have to make sure that that signal doesn't go above limit or below limit. I have to check atleast 5 times the values of each signal before making a warning or alarm. So i have array of signal inputs, for this type of mechanism i have to create a state machine. so how to go ahead with while loop or for loop?

0 Kudos
Message 4 of 13
(4,823 Views)

That doesn't sound like a state machine.  That just sounds like a processing loop.  FOR loops are perfectly fine for that.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 13
(4,816 Views)

Hi, 

 

     Is it possible to do in these kind of operation in a state machine (Input array). if so how?

0 Kudos
Message 6 of 13
(4,807 Views)

Hi, 

 

     Is it possible to do in these kind of operation in a state machine (Input array). if so how?

0 Kudos
Message 7 of 13
(4,807 Views)
It makes no sense to have states that represent the readings. You can have a single state that evaluates all of them in the array. Is that what you are asking?
0 Kudos
Message 8 of 13
(4,798 Views)

Hi,

               

          Readings are not states here i wanted to ask, increment in incase limit is higher or lower decrementing in case like that  other functions in the program for warning and alarming the user. For that puepose i asked state machine wrt For loop or while loop. 

   

0 Kudos
Message 9 of 13
(4,790 Views)

Before you use the words "state machine" again, please go read this: http://en.wikipedia.org/wiki/Finite-state_machine

 

Nothing you're talking about has anything to do with a state machine.  But, let's answer your original question. It's silly to make a state machine with a For Loop.  If a For Loop makes sense for the application, a state machine doesn't.  It's a trivial task to add a Shutdown state to a state machine to stop the While Loop.  If that doesn't make sense for what you're trying to do, then you don't want a state machine.  When you're aware enough to know you don't know a lot about the topic, it's generally a bad to marry yourself to the idea of a state machine even though those you seek for help are telling you that's not the answer.

0 Kudos
Message 10 of 13
(4,780 Views)