LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to put 3 condition in two files

Dear sir,

 

 I have two files  Both having 5 columns,  example is given below.

FILE-1                                                    File-2                
A    B                      C    D    E                X    Y          Z    W    T
2    1.23375E+17    30    31    2                1    41.998    0    0    0
2    2.04196E+17    0    32    2                1    42.959    0    15    0
2    2.3028E+17    30    32    2                1    43.888    0    30    0
2    2.31994E+17    0    33    2                1    44.84    0    45    0
2    2.01626E+17    30    33    2                1    45.873    1    0    0
2    1.79445E+17    0    34    2                1    47.045    1    15    0

 

 now i want to put a condition when,

 

A=X , D=W,  E= Z all these value i want to take in othere array.

 

My files and and programme are attched with this mail.

 

Download All
0 Kudos
Message 1 of 11
(3,464 Views)

This way might be a little easier to start with. It's very slow, since it compares each line in file 1 against every line in file 2. It could be sped up by saving the 2D array indices, since A and X are increasing.

0 Kudos
Message 2 of 11
(3,434 Views)

Thanks for reply,

 

But this programme is not competible to my data file.

here

column  A  and X having the value 1 to 32.

 

Column E qand Z having the value  0 to 23.

and

 Column  D and  W having the value 0, 15, 30, and 45,

 

now i want to put the condition when A=X= 2,  then if  E=Z= 0 to 24 and D=W=0,15,30,45 then take take all the value in array..

 

my programme is attached here.

0 Kudos
Message 3 of 11
(3,392 Views)

What kind of data file are you using?  Can you post a sub-VI of the file operation you are trying to perform so we can better assist you?  One problem you are going to run into is your BD is way too busy.  This makes it more difficult for people to sort through and adds too much complexity to the problem.  This may not be your fault and it may be inherited code, if so, you have my sympathies.  But you should try to keep things modular if possible.  Now we can, as Todd has done, try to give you some ideas with VIs of our own.  Of course they will not be drop-in replacements for your VI but it might give you some ideas.  If you can create a sub-VI of the file operation it would be helpful.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 4 of 11
(3,365 Views)

I appreciate with you,

 

wt i want to do is ,

FILE-1                                                    File-2                
A    B                      C    D    E                X    Y          Z    W    T
2    1.23375E+17    30    31    2                1    41.998    0    0    0
2    2.04196E+17    0    32    2                1    42.959    0    15    0
2    2.3028E+17    30    32    2                1    43.888    0    30    0
2    2.31994E+17    0    33    2                1    44.84    0    45    0
2    2.01626E+17    30    33    2                1    45.873    1    0    0
2    1.79445E+17    0    34    2                1    47.045    1    15    0

 

Keeping A=X=2, at the same time vary E=Z = 0 to 23, if they are equal take these value in array.

 

next step keeping A=X=3, at the same time vary E=Z= 0 to 23, if they are equal take these value in array.

 

repeat tis process of A=X= up to 32,  for each condition of A=Z = 2 to 32, vary E=Z= 0 to 23.

 

What i did in my programme is

1-open both files and seraching for 2 from column A of file-1 and X of file-2 from both files if they are equal.

 

2- in the next step i keep condition if column E of file -1 and column Z of file two having the same value. take all these value separtely according to files.

 

 my programming and files  attched here. which is ver simple to understand.

 

and also files-1 and -2.

 

 

Download All
0 Kudos
Message 5 of 11
(3,352 Views)

@julian prince wrote:

I appreciate with you,

 

wt i want to do is ,

FILE-1                                                    File-2                
A    B                      C    D    E                X    Y          Z    W    T
2    1.23375E+17    30    31    2                1    41.998    0    0    0
2    2.04196E+17    0    32    2                1    42.959    0    15    0
2    2.3028E+17    30    32    2                1    43.888    0    30    0
2    2.31994E+17    0    33    2                1    44.84    0    45    0
2    2.01626E+17    30    33    2                1    45.873    1    0    0
2    1.79445E+17    0    34    2                1    47.045    1    15    0

 

Keeping A=X=2, at the same time vary E=Z = 0 to 23, if they are equal take these value in array.

 

next step keeping A=X=3, at the same time vary E=Z= 0 to 23, if they are equal take these value in array.

 

repeat tis process of A=X= up to 32,  for each condition of A=Z = 2 to 32, vary E=Z= 0 to 23.

 

What i did in my programme is

1-open both files and seraching for 2 from column A of file-1 and X of file-2 from both files if they are equal.

 

2- in the next step i keep condition if column E of file -1 and column Z of file two having the same value. take all these value separtely according to files.

 

 my programming and files  attched here. which is ver simple to understand.

 

and also files-1 and -2.

 

 


It may be easy for you to understand, because you coded it.  There is no documentation or comments anywhere except a couple of line labels.  It seems your code is overly complicated for what you are trying to do.  First, adding to the confusion:

 

"Keeping A=X=2, at the same time vary E=Z = 0 to 23, if they are equal take these value in array.

 

next step keeping A=X=3, at the same time vary E=Z= 0 to 23, if they are equal take these value in array."

 

This is not what you said in your original post.  There are some issues with your code but that's for another time.

So I understand it better, if A = X = 2 and E = Z && 0 <= E <= 23 && 0 <= Z  <= 23, then the process repeats for A = X = 3 etc.

 

Extract column 1and compare, autoindexing through For loop (like you are).

Extract column 5 from file 1 and column 3 from file 2.  Compare if equal && they are in the range 0-23.

Inc for A = X = 3 and repeat process.

Is that right?

Following this qseudo code may help you to better organize your program.

But one thing you haven't mentioned, what results are you getting?  Where's the problem?

 

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 6 of 11
(3,341 Views)

Dear sir,

 

 which programme is not working for my files,

 

wt i want to do is ,

FILE-1                                                    File-2                
A    B                     C    D     E                  X    Y           Z    W    T
2    1.23375E+17    30    31    2                  2    41.998    0    0      2
2    2.04196E+17    0    32      2                  2    42.959    0    15    2
2    2.3028E+17     30    32     2                  2    43.888    0    30    2
2    2.31994E+17    0    33      2                  2    44.84      0    45    2
2    2.01626E+17    30    33    2                  2    45.873    1    0      2
2    1.79445E+17    0    34      2                  2    47.045    1    15    2

 

I want only those value are equal in column A=X  and E=T,, but programme doesnt shows any value,

it shows there is none equal value, but in file there are value,

 

please help me,,

here is my files

Download All
0 Kudos
Message 7 of 11
(3,313 Views)

Have you tried reading the file out as tab delimited into a 2D array.  From there, comparing the two row-row is simple.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 8 of 11
(3,311 Views)

thanks for reply sir,,

 

 

i tried using  that solution but i am not getting the exact value, even i am not getting for single column value.

 

suppose i am taking A=X give these value in array, even for the same programme isn't working..

 

please sugges me sir,

 

 

0 Kudos
Message 9 of 11
(3,294 Views)

I will try to find time to get an example to you tonight.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 10 of 11
(3,284 Views)