04-07-2014 04:56 AM
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.
04-07-2014 05:18 AM
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.
04-08-2014 10:35 AM
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. !!
04-08-2014 01:22 PM
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.
04-09-2014 06:10 AM
Thank you very much for your help.
Its working fine.
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 !!
04-09-2014 07:10 AM
Sorry, I did not really understand your request.
What string should be generated? How it should look like? Could you write more about it?
04-09-2014 07:46 AM
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.
04-09-2014 08:14 AM
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.
04-09-2014 08:30 AM - edited 04-09-2014 08:31 AM
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.
04-10-2014 06:28 AM - edited 04-10-2014 06:39 AM
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?