LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compare Indicator

Hi there ! I'm a pure beginner in LabView. My question are:
1. Is it right if I make a text file by writing the data directly using Notepad program. In this case I just write down the number (0,1,2,.....n) and each number end by carriage return (enter key). Or I have to use the LabView procedure to write my file ?
2. I already made two text files that contain number like I asked in no.1 (using Notepad). I've done the comparison of that two files. But I have problem to write it to a new text file, because I don't know to make a format in that new text file. I want to make it like table and contain header "no", "line" , etc. How to make a "formatted" text file like table and can be open using Notepad ?
3. I used the boolean to be the fault indicator. T
hat mean if the compare process found that the two files are not the same, this indicator will "on". But the indicator only "on" when it sees the fault. After that it turns off again. How to make a boolean has a latch function ?

I need to solve this problem immediatly regarding to my project. So, please help me...Thanks
0 Kudos
Message 1 of 10
(4,050 Views)
Ricki,

1.& 2.:Yes, you can produce a text file with every editor like notepad and read it with LabVIEW. Look at the NI examples in the DEV zone, there are lot of VIs that do what you want (writing headers etc., ie look at: http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/f7ce29d12bcd854d8625692d0059ada5?OpenDocument).
3. Use can use a property node to change the value of your boolean indicator programmatically ...

Hope that helps,

Michael
0 Kudos
Message 2 of 10
(4,050 Views)
For more information on how to format text files, please look in the examples that are shipped with LabVIEW. If you have LV 6i there are some ASCII examples under File I/O that will show how this is done in LabVIEW and if you have 6.1 they are all grouped together under File Input & Output. The function you will likely use is the Format into File, using tabs and carraige returns to format your data into a spreadsheet format. Hope this helps!

Jim Cahow
Applications Engineer
National Instruments
0 Kudos
Message 3 of 10
(4,050 Views)
Thanks to Michael and Jim. I'll try my best.

Michael, could you help me again about the latch problem. You said that I can use the property node, but how to do it ? Could you be more detail on this ? Thanks.
0 Kudos
Message 4 of 10
(4,050 Views)
How are you doing your comparison? If you are doing it line by line and that is the reason the Boolean is switching on and off, use a shift register. Or the contents of the shift register with the current comparison and make that your indicator. I've attached a simple VI that shows how to do that.
0 Kudos
Message 5 of 10
(4,050 Views)
Hi Dennis...
After I saw your attachment file, I thought I have to change my problem.

I have Test1.txt file contain "0,1,2....15". And second I have Test2.txt file too that contain the result of some process. This Test2.txt should contain the same "0,1,2...15" like Test1.txt, but in sometime it could be different. So, what I want is to compare the "0" on line 1 of Test1.txt with the data on line 1 of Test2.txt. And "1" on line 2 of Test1.txt with the second data on line 2 of Test2.txt, and so on. So, this what the process I called line-by-line comparison. I did it with "Read File" function of LabView.

My problem now is since I didn't "translate" my file to be an array, how can I make it ? I want my data from Test1.txt file read and t
ranslate it to an array. If I could translate it, I could use your method to solve my latch problem.

Thanks
0 Kudos
Message 6 of 10
(4,050 Views)
The example wasn't to show how it should be done with an array but how to use a shift register. If you're doing two Read File functions line by line in a while loop, then add the shift register to that. If you really want to convert it to an array, then one way is use the Spreadsheet String to Array function. Specify the delimiter as a line feed constant (or whatever terminates each line) and the array type as 1 dimension string type.
0 Kudos
Message 7 of 10
(4,050 Views)
Thanx Dennis...it works !. But now I have another problem. I already add the latch indicator, that indicates if one or more line has a mismatch each other. The problem is I want to know which line number that has a fault condition. The input signal will be taken from the result of array comparison. If it's true than the line number will be written, if it isn't then don't write the line number. The new simple array indicator (which contain the fault line numbers) is adequate for me, but it would be better if I could write it to a new text file too. Thanx Dennis and I wish you still could help me this time.
0 Kudos
Message 8 of 10
(4,050 Views)
Determining which lines have a fault is easy. If you're using a loop, when there's a mismatch, take the index of the loop and add it to an array. Use another shift register and inside of a case statement, either append the current index or not.
0 Kudos
Message 9 of 10
(4,050 Views)
Sorry Dennis, I already try it in whole weekend, but still can't make it. I already have two arrays and compare it line by line like your example. But I still can't use the index of the loop and shift register in the case statement. Could you be more detail on this ? Thanks
0 Kudos
Message 10 of 10
(4,050 Views)