LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to do comparison between array of strings using Labview

hello....
i want to know how to do comparison between array of strings in labview. the transmitter have assigned text with verb such as
 
A   hye                                               B helllo                                              C  good morning
 
 
the receiver have to make comparison bertween this first letter A,B and C. then assigned it into speadsheet. And coloum A is for A, and coloum B is for B, and coloum C is for C. I donno what is the proper block i should use. 
What i can use for this kind of problem.?
 
Below i attached the program and i have problem with the comparison part. help me
0 Kudos
Message 1 of 17
(4,071 Views)

I just started to look at your code and stopped immediately when I saw this (see image below):

What are you trying to do?  Do you realize that you are trying to communicate to the same serial port from 3 parrallel instances?

Although your indicator say "read buffer", I don;t see any serial reads..  just "VISA Writes".   Please start at the top.  What are you trying to do, because writing to the proper Excel column should not be that difficult..  I can create an example, but I suspect you have many other obstacles before reaching that point.

RayR

 


Also, do you realize that each time the "Write" buttons are OFF, that it clears the text?  If it is intentional, then a good idea is to place a comment to that affect or better is to place an empty string constant in the false case and wire it to the string output tunnel.

Message Edited by JoeLabView on 03-10-2008 10:24 AM
Download All
Message 2 of 17
(4,049 Views)
ok..thank you..actually, the transmitter is seperated from the receiver. for this first time, i connected them together. refer to the block diagrm i post, the receiver is behind transmitter. what do you mean by dont have any serial read?i dont get it.It is i have to have different baud rate and ect for each VISA writes?It is correct i assign them into A,B and C?
besides that, i want to make the receiver to compared:-
 
If data(text) is assigned by the transmitter is A, then it will go to column A.
Else go to column B and compared it is assigned to B. If yes, it will go to column B.
Else it will go to column C.
 
I donno how to make this comparison. As long as the text from A will go to A, and B to B, and C to C, I dont mine what type of compare that will be use( lengtah of strings, size of array, ect) . As long as the text will go to the right place.
0 Kudos
Message 3 of 17
(4,024 Views)
When I opened the VI, it was broken - see attached.
 
As Ray mentioned, your Vi will potentially send a command to all three instruments simultaneously.  Without the repair to the broken area it is hard to tell what other problems you might have.  Also, you should try to avoid hiding wires with structures - this makes it difficult to follow data flow.  Could you post a sample of what your instrument replies are?  If there is no unique identifier to tell who replied, then you will need to do a read and write per instrument to be able to properly assign the data to a column.
Jim

LV 2020
0 Kudos
Message 4 of 17
(4,010 Views)

Hi syanitaa,

So if I understand correctly, the real code would have 3 seperate write functions, all distinct?  And not transmitting at the same time..

You could have a sub-vi which takes care of the transmit and the indexing and/or writing to the spreadsheet.   You could simply have a control that selects to which transmitter is active.  Inside this, you could use the same transmitter index to also index the appropriate column.  In this manner, you would not have to append the letter A, B, or C to the text or data, unless you have to.

If the above is what you need, then there is no comparison involved.  Just a selection of which transmitter to use.

RayR

0 Kudos
Message 5 of 17
(4,009 Views)
hello...
the transmitter that i send to you can transmit data randomly.
 
transmitter
Col 1                                                      Col 2                                                     Col3
hye                                                        hello                                                       bye
 
when i run the program, the data will trasmit randomly as below.
 
hyehellobyehellohyebyehyebyehello
 
 
the data transmit not follow the sequence, thats why its transmit randomly. My problem now, i want to build the program that can  receive data that transmit randomly like above into a spreadsheet. It mean, hye will be receive in column 1, hello will be received in coloum 2, and bye is receive in column 3.
Here, i attached the latest program.
 
:...  In this program, u have to run, then after few second, you must press button Stop(all 3 button stop), after that spreadsheet will be appear. i want the correct word will be receive in correct column.
0 Kudos
Message 6 of 17
(3,980 Views)
The is nothing in your code to look for a unique identifier. First you say that each write will prepend something like A, B, or C to the string being written but in your last description, you do not mention it and in your read, you do not look for anything. You will have to add some identifying character to each write and then when you do a read, parse it out and assign the data to the correct column. Your whole scheme of writing to the table does not make any sense. For every read, you create a whole new table. Also, your while loop with the VISA Read with the True constant outside the loop is just wrong because it means that the while loop will only iterate once.
0 Kudos
Message 7 of 17
(3,973 Views)
It appears to me that your data is random because the three loops that talk to the transmitter are not sequenced in any way.  If you pair each write with a read, you will know which device the data is from, no identifiers needed.
Jim

LV 2020
0 Kudos
Message 8 of 17
(3,968 Views)
You will have to add some identifying character to each write and then when you do a read, parse it out and assign the data to the correct column    >>>  yes, u are right, but i donno how to do that..i attached the new one, the transmitter with seperated from the receiver. It is correct?it is correct i identify the name?
 
And, i have to put the identifyer, because my objective is to collect the random data into the spreadsheet. and located them into the correct column.. My problem is how the receiver to identify the identifyer name. What block can i use?
0 Kudos
Message 9 of 17
(3,952 Views)
Use String Subset to seperate it into the 1st character and the rest of the string.


Message Edited by Ravens Fan on 03-11-2008 03:20 PM
0 Kudos
Message 10 of 17
(3,944 Views)