From 11:00 PM CST Friday, Feb 14th - 6:30 PM CST Saturday, Feb 15th, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

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
(3,895 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
(3,875 Views)

Duplicate thread


GCentral
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
(3,866 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
(3,860 Views)

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


GCentral
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
(3,853 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
(3,844 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
(3,844 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
(3,835 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
(3,827 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
(3,817 Views)