LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compare numeric control to an array and output values

Just started on labview and would like to get started on a simple project. Here's the process flow I'd imagined.

 

1. Enter numeric control

2. Press OK

2. Scans a spreadsheet file and locates the row for that numeric value

3. Outputs colunms 2 as a numeric indicator nad colunm 3 as a string indicator

 

 

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

What have you got so far?

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

I think I just completed it however would like to know if there is cleaner/easier way of writing this. 

 

Thanks, 

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

There are several things I would suggest.

 

1. Remove the 1-iteration For loop. It does nothing.

2. Only read the file one time. With your small file it is not a big issue but if your file was ~100 MB your approach would crash with out of memory errors. Second, the information is all there so why not just process it?

3. Since you do not do anything with most of the data, just convert what you need.

   A. Change the "Numeric 3" control to a string control and use Match Pattern to find the matching string in the string array.

   B. Only convert Lever Block to a numeric data type if you are going to do some math.  If all you will be doing is to display it, leave it as a string.

   C. Only do the conversions and update the displays if a math is found.  Users have been known to type things incorrectly.

4. Make the data type of the controls and indicators match the data.  Numeric 3 and Lever Block should be I32, not DBL.

 

Note that I saved the data from the file in controls with "Make Current Value Default" so I did not need to read the file each time during development.

 

Lynn

Message 4 of 4
(2,111 Views)