01-06-2012 12:39 AM
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.
01-06-2012 02:03 PM
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.
01-10-2012 06:39 AM
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.
01-10-2012 10:48 PM
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.
01-11-2012 03:23 AM
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.
01-11-2012 08:04 AM
@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?
01-16-2012 06:37 AM
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
01-16-2012 07:20 AM
Have you tried reading the file out as tab delimited into a 2D array. From there, comparing the two row-row is simple.
01-17-2012 02:28 AM
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,
01-17-2012 01:40 PM
I will try to find time to get an example to you tonight.