LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to compare one by one element of one column with other table's first column ??

Solved!
Go to solution

Thank you very much for your help.

Its looks good.

Can it possible to make this vi for fix number.

For example if I want to make comparison for 5 ids then I set the value 5 and after 5 reading the vi should stop.

Same for 10 readings after 10 comparison vi should stop. 

 

Again thank you very much for your time.

0 Kudos
Message 11 of 21
(1,519 Views)

In this case I think you could use, with some small modifications, the first VI that I uploaded and you will get results in the Cluster.

If you add some indicators into the cluster you will have ID, LED and also rest of the parameters in the cluster.

 

 

Duri
0 Kudos
Message 12 of 21
(1,513 Views)

Hello,

 

I am facing one more problem that when ever I am trying to compare the file then I am not getting the proper result.

Here in attachment I have attached one vi for comparison.

And the thing  is I want to compare IDs with the spread sheet or .txt file that's look like as per attached file.

I want to compare only first column of the log file with the Id which I enter.

can you please guide me how can i solve this problem.

Hope you will get my point.

 

Thank you very much for all your help in advance. !!

Download All
0 Kudos
Message 13 of 21
(1,493 Views)

Hi,

 

For loop in the while loop is not very good solution, because in each while loop iteration you are searching for an ID in for loop continuously. At least you should use Wait until next ms multiple or something similar to let the CPU control other events.

 

In the Read From Spreadsheet File.vi you did not specify delimiter, in your case it could be \s = white space. You can display codes in string control/indicator right clicking on the control and selecting '\' Codes Display and write there '\s' without apostrophes. In this case you will search for and ID in the rows (1D array) of the 2D array.

 

I have modified the VI so you can have a look and modify it as needed.

I used Event structure, so you can enter the ID and click on START and you will get your values in the indicators if the ID is found.

 

Hope it helps.

Duri
Message 14 of 21
(1,483 Views)

Thank you very much for your help.

Its working fine.Smiley Happy

 

I need one more help that how to make logic that if Id is match then I forward string will generate , if id is not match then stop string generate and if Id is is equal to final id then stop string will generate.

That final id inform the program that this is final ID and now no need to read more id.

 

Hope you will get my point.

Thank you very much once again for your help !!

 

 

0 Kudos
Message 15 of 21
(1,470 Views)

Sorry, I did not really understand your request.

 

What string should be generated? How it should look like? Could you write more about it?

Duri
0 Kudos
Message 16 of 21
(1,457 Views)

Hi,

Thank you very much for your reply.

Here In attachment I have attached that vi.

In that when id is match then it generate Go forward statement.

And when id is not match then Stop statement.

But I also want to add one more function which is Final Id number, when it is match  with the current ID then program should be stop or stop message should be generate.

Hope you will get my point.

 

Thank you very much once again for your help and time.

0 Kudos
Message 17 of 21
(1,448 Views)

Untitled 2_MOD_v2.png

 

I do not see any reason to use Final Id and for the notes you mentioned above it is enough to use only the value of Boolean.

 

You will increase your skills when you will debug your own VI and will try to find solution.

 

Hope it helps.

 

Regards.

Duri
0 Kudos
Message 18 of 21
(1,440 Views)

thank you very much for your reply,

 

yes i know this point but the thing is for example in file which i need to compare wiith id, have 5 elemnets in column 

12

13

14

15

16

and the id which i want to compare with the IDs from the file is for example:

step by step is 

12 then 

13 then 

21 then 

25 then

16.

means some id match then forward message generate and if not then stop msg.

that is one operation but what i want to add one more operation that some perticular id number is found then it will stop the operation.

in my last attached vi if i give for example 16 to final ID then when that id is match with current id then programm will be stop othervise normal operation is going on.

The thing is that final id i dont want to compare with the IDs form the file, but that i want to compare with the current ID.

 

Hope you will get my point.

or do i need to give more explaintion then pelase let me know.

 

Thank you very much once again for your help.

0 Kudos
Message 19 of 21
(1,436 Views)
Solution
Accepted by topic author AnkitRamani

Hi  Ankit,

 

so:

1. you want to set an ID that you want to search in the first column of the file.

2. if you find that ID in the file, "forward" message is generated and the data (X, Y) is displayed in the indicators,

- the program does not stop its execution,

- it finds only the first occurence of the ID in the file

3. if you do not find that ID in the file, "stop" message is generated,

- the program does not stop its execution,

4. if the FINAL ID is equal to ID, the program stops its execution,

- no message is generated

 

so the program will stop only if the FINAL ID and ID are equal?

 

Will this be a SubVI?

 

Is it not better to use only for loop to search the file for the ID and if the ID is found, "forward" message is generated, led is true, and data (X, Y) is forwarded?

if the ID is not found, "stop" message is generated and obviously no data is forwarded.

and before all of this check if the ID is equal to FINAL ID, if they are equal, skip the rest if they are not, do search if the ID is found or not?

 

 Untitled 2_MOD_v3.png

 

Duri
Message 20 of 21
(1,404 Views)