LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extracting Data from Array.

Hello, users and companions of LabVIEW and National Instruments Products, Hello, I'm working in a proyect with 2 Incremental Encoder Mitutoyo, I have a Digital Read Out (DRO) System for read the encoders,
The proyect consist in measure a Paraboli Suspension for the cars; using 2 encoders, in X Length an Y for the thickness.
 
I have a routine for read data from the DRO, then the data are storage in an array, but when data are sending from the DRO to my computer send like the next example:
 
    X          Y
0.000   0.000
0.000   0.000
0.325   0.256
0.325   0.256
0.325   0.256
0.000   0.000
0.370   0.289
0.370   0.289
0.370   0.289
0.370   0.289
0.000   0.000
0.412   0.315
0.412   0.315
0.000   0.000
0.000   0.000
 
I want to extract the data in a new array only if the data are diferent and eliminate the zero like the array shown below. The data shown above are corrects, but i don't need the zero and the data repeated one or more times, this frequency of repeated data may be to vary.
 
    X          Y
0.325   0.256
0.370   0.289
0.412   0.315
 
I obtain the zero because I need to obtain the more amount data with respecto the time, if the time
to read the DRO is 50ms before of the read the serial Port don't appears the zero and have data very slow; but if is 10ms I have more data.
 
I have tried many forms to extract this data to a new array, but I can not to do this operation.
 
The VI what I did is anexed in this mail. When select the stop button the array is executed.
 
Thanks for your help Greetings and Blessings.
 
Ing. Jorge Alonso Cardozo Rodriguez.
 
 
 
 
 
 
0 Kudos
Message 1 of 8
(3,991 Views)

I took a brief look at your vi. My idea would be to initialize your data array outside the loop(maybe 2D array of 1000 rows and 2 columns), that way you aren't using build array inside the loop.  Wire this initialized data into a shift register on the while loop. Then inside the loop, use replace array element to replace data only if both values are not equal to zero. Use another shift register to keep track of where to insert the data into the 2D shift register.

 

Can you post some sample data strings?? I think you can decode the serial port string a bit easier. What labview version are you using??

Message Edited by unclebump on 08-02-2006 02:28 PM

0 Kudos
Message 2 of 8
(3,984 Views)
I agree with the uncle that you should filter right at the source and only append the data if it is unique.
 
To clean up the array later, you could do something like in the attached (You might need to tweak the logic a bit).
0 Kudos
Message 3 of 8
(3,991 Views)
Here is what I was thinking. I added to the top of your while loop to save 1000 rows of data.
0 Kudos
Message 4 of 8
(3,966 Views)

Thank you for your help Altenbach, the vi is very good, is a honor meet you, congratulations for your mention, I lack myself to comment what if the next data after a zero is the same in the array in the column X  it don't must be appear. How can I to do this modification? 

 

0.412   0.315

0.412   0.315

0.000   0.000

0.412   0.315

0.000   0.000

0.000   0.000

0.412   0.315

0.412   0.315

    

Esteem much your aid  and the one of the other companions, thanks for your help.

 

See you later, Greetings and Blessings.

 

Ing. Jorge Alonso Cardozo Rodriguez.

 

 

 

0 Kudos
Message 5 of 8
(3,951 Views)
You just need a small modification and do the two test sequentally:
  1. Check for zero. If zero, do nothing
  2. Check for same as previous nonzero. If same, skip.

See attached.

0 Kudos
Message 6 of 8
(3,949 Views)
Thank you for your help Altecnhback, I'm new in a Graphic Programing like LabVIEW, is a excelent tool for proyects, applications and design and investigation, I'm a engineer young, 23 years old, i have a short time for the proyect, thank you for your help, besaides I'm working with the mechanic design, is very interesant the mechanic design, but I'm Electronic Engineer.
 
See you later. Blessings.
0 Kudos
Message 7 of 8
(3,923 Views)

Hello, Altenbach, remember me? Thanks for your help in the VI that you send me, very good, like you tell in the past I'm working in a proyect with 2 Incremental Encoder Mitutoyo, I have a Digital Read Out (DRO) System for read the encoders,

The proyect consist in measure a Parabolic Suspension for the cars; using 2 encoders, in X Length an Y for the thickness.

 

I have a subroutine for read data from the DRO, then the data are storage in an array.

 

Then in other sub-VI extract  certain information with the next criterion:

 

In the information that I obtain I don't need:

 

1.- Data that are equal to zero in X and Y columns

2.- Data that are equal in X and Y columns

 

But now I need eliminate the first data from an array (X and Y) between two data that are equals in X Column. (See Extract Data2.bmp) Only I need the second data.

 

I want if some of you, can I help me? for complete this task.

 

The VIs what maxe this task is anexed in this mail.

 

I value your aid. Thanks for your help, Greetings and Blessings.

 

Ing. Jorge Alonso Cardozo Rodriguez.

 

 

Here is the VI that I am using for eliminate the conditions 1 and 2, but I need your help for eliminate the data of the third condition, because in the information that I obtain of diferents measures of diferents types of parabolic suspension of cars in the company where I am working; this data is invalid, when this condition is present.

 

P.D. The data of the VI is only a example, in the real, I obtain approximately 1000 real data, where this third condition is present is in caulquier moment or place with a frecuency of 10 times. This happens because I demand many data to the Serial Port, when I diminish the time for the next read I obtain approximately 700 real data, But I need the greater amount of real data for to reconstruct with one better resolution the parabolic suspension of a diferents models of cars.

 

I am trying make the changes in this VI but I have little time.

 

Thanks for your Help.

 

San Luis Rassini Corporation.

Ing. Jorge Alonso Cardozo Rodriguez.

 

Download All
0 Kudos
Message 8 of 8
(3,809 Views)