11-12-2025 07:59 AM
Good morning everyone, here's my problem: I have an .ini file from which I need to extract values (there are several lines, with two columns: the first column shows the lambda value (nm) and the second column shows the corresponding values). Based on the current lambda value, I need to be able to select the correct other value and then save it to the file. I am currently using the “Read from text file” VI to select the rows, so I end up with an array containing all the rows I need. How can I tell LabVIEW that if, for example, the current lambda is 202 nm, it should only take the value of the array corresponding to 202 nm? I have no problem opening the file and “unpacking” the array, but I don't understand how to compare the values. I hope you can help me. Thank you.
Solved! Go to Solution.
11-12-2025 08:58 AM - edited 11-12-2025 08:58 AM
Hi giuli,
You can explore comparison pallet and use either "equals to" or "in-range and coerce" function.
11-12-2025 09:09 AM - edited 11-12-2025 09:10 AM
Words cannot really describe well what you actually want to do. But you seem to implement a simple lookup table.
If you have no problem "unpacking" (sic), why not attach your VI so we can get a better picture? It seems you are not really doing a "compare array", but searching one column. Not quite the same.
11-12-2025 10:25 AM
Thanks for your reply! In the .ini file (I'm attaching an example), there are several lambda values (integers), and each one corresponds to a sensitivity value (E-14 format). The current lambdas in the program are in integer format, so they necessarily have a match in the file. I need the program to acquire the values from the .ini file and compare them with the current lambda. After finding the match, I need to save the exact sensitivity value. I hope I have explained myself clearly. I am attaching an example of VI (I am testing it before inserting it into the final program). As you can see, there is a while loop, so it does not exit until the exit condition (i.e., it has found the match) is met. Please forgive me, but I am still a beginner.
11-12-2025 10:39 AM - edited 11-12-2025 10:41 AM
See if this can give you some ideas.
(Please don't use a greedy loop that continuously reads the same file over and over again as fast as the computer allows.)
11-13-2025 02:06 AM
Thanks so much, I think it'll work. (The while loop was just a test, obviously.) The important thing is that for each value of lambda, it can calculate the value, and that's perfect. Have a good day.
11-13-2025 08:26 AM
Of course you should also implement some error handing, for example you could return NaN if the entered lambda does not exist. Currently it would return zero.