LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read data from table

I have this table and want to read data from each column and check how many times it went from 0 to more than 0 for each column respectively and display it

0 Kudos
Message 1 of 7
(6,859 Views)

Posting a VI with an empty table and no code is not going to get you much help.

 

1. Please put some typical data in the table, Make Current Value Default, and save.

2. Show what the output should look like for that data, even if you do not now how to program it.

3. Make an attempt to write a program to do the job and explain what it does wrong or where it fails to get the desired results. Post that.

 

Lynn

0 Kudos
Message 2 of 7
(6,857 Views)

Sorry uploaded the wrong vi. I actually have tried doing this. I need to extract the data from table one channel(column) at a time. Count how many times the values from the column goes from 0 to more than 0 per channel and store it in the array.

0 Kudos
Message 3 of 7
(6,850 Views)

That VI fragment does not give an indication of what you were trying.  It does indicate that you do not understand dataflow.  Get rid of the local variables.  Use the shift register.

 

Can the values ever be negative or non-numeric? The table output is an array of strings and could contain other characters.  How will you handle that situation if it ever occurs?

 

The way I would approach this is to write down a detailed description, probably as a flow chart/state diagram, of what the program is to do.  That becomes the guide for writing the program.  It might look like this as text:

 

1. Select column.

2. Convert to numeric. (?) Maybe just test the strings.

3. Get next element.

4. If = "0", then Set Flag = Zero,

               else Set Flag = Not Zero.

5. Get next element.

6. If > "0", then Increment Count and Set Flag = Not Zero,

                else go to 5.  (Note: if negative values or non-numeric values may occur, additional tests will be required here.)

7. When all elements have been tested, get next column and go to 2.

 

Lynn

 

0 Kudos
Message 4 of 7
(6,821 Views)

I am aware of the logic. However I am very new to labview and hence wanted some help regarding its implementation in labview

0 Kudos
Message 5 of 7
(6,809 Views)

OK. Once you have a description of your logic, you go through each part and find the corresponding LV function or primitive to implement it.

 

Using the description I posted yesterday you might get something like this.

 

1. Select column = Index Array with the selection value wired to the column index and the row index left unwired.  Output will be a 1D array containing the selected column.

2. You are already familiar with at least some of the string to number functions.  It might be possible test by comparing strings directly, depending on error conditions. That would eliminate this step.

3. and 5. and 7. For loop or while loop, possibly with autoindexing.

4. =0? from comparison palette.  Result might be the flag directly or could select flag values via a selection primitive, also on the comparison palette. Flag will reside on a shift register.

6. Case structure.  This could be done with elements form the comparison palette but multiple things change and the case structure allows more vesatility.

 

None of these are exotic or highly advanced LV tools, so you need to spend the time to learn how they work.

 

Lynn

0 Kudos
Message 6 of 7
(6,780 Views)

It's actually pretty straight forward, you had the string to integer function, next transpose the array (LabVIEW likes to handle rows first then columns). Then wire the output of the transpose array into the first for loop. Now delete the first element from the array and wire it to the shift register of the inner for loop, wire the remaining element to the inner for loop. If the shift register is zero and the current value is > 0 then increment your counter. See the attached vi

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
Message 7 of 7
(6,771 Views)