LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

iterate array by row

Hello:

I am really new to labview and I do have a question about how to use the data from a predefined excel file to control my machine.

The excel file has three colums which are time, temperature and water level and more than 1000 rows. Time, temperature and water level are all different for each row.Based on the information from this table, I need to control my machine to matain certain temperature and water level for a period of time according to the corresponding colum 1 time number. What I have done so far is only read the predefined excel table and save as a 2D array. I am thinking to use a for loop to read the array row by row, and then assign each number to corresponding machine port, or just use a timed loop. I really run out of ideas. Need help, Thanks!

 

 

0 Kudos
Message 1 of 4
(2,800 Views)

Well, using a FOR loop like this traps you into inner code that might be hard to escape (except maybe using the conditional terminal).

 

I would read the file as you have now, then use a state machine.(states are reading a new file, process rows, pause, stop, etc.) The central case is where you process the rows. Keep track of the current row in a shift register, read the first row, apply the setpoints, and check for the elapsed time regularly. When the time has elapsed, increment the row and repeat. If you run out of rows, go to the idle state, or whatever.

Message 2 of 4
(2,789 Views)

Thanks for your answer. But how do I use the state machine? Is there a sub vi ready?

 

Thanks,

0 Kudos
Message 3 of 4
(2,782 Views)

There are templates that ship with LabVIEW.

0 Kudos
Message 4 of 4
(2,764 Views)