LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Edit strings in Labview

I have created a Labview program that generates a string of low level code to control a machine. For creating the string, I'm using Concatenate String, which combines different strings into one. My problem is that when I add a comma into the string, it automatically jumps to the next line, spliting the line into two. Example:
- goal:
data 60, -345
- actual program:
data 60
, -345

Does anyone know a way to solve this problem?. The machine that I'd like to control with this commands is not able to understand the commands as they are now.

Thanks in advance for your help.
Javier
0 Kudos
Message 1 of 9
(3,824 Views)
Javier,

I was unable to reproduce your problem, could you attach an example? That way someone may help you.

Saludos
0 Kudos
Message 2 of 9
(3,824 Views)
I suspect this is a red herring. The representation of strings in front
panel elements, probes and constants automatically word wrap to make them
easier to read. This does not mean the string itself is having extra line
feeds inserted, and changing the representation of the constant or front
panel element by selecting "/ codes display" from the right mouse button
popup menu over the string will allow you to see each character, even non
printable/whitespace. I suspect some other characters are present in your
string that are screwing up the instrument, and in this mode you'll be able
to track them down and stomp them.

Gorka Larrea wrote in message
news:506500000005000000D2310000-991728092000@quiq.com...
> Javier,
>
> I was unable to reproduce yo
ur problem, could you attach an example?
> That way someone may help you.
>
> Saludos
0 Kudos
Message 4 of 9
(3,824 Views)
Hi Javier,
The concatenate string function should not add a carriage return and/or line feed. I am suspecting that your string with data 60 might include this character. An easy way to check it is by viewing the data 60 string in the diagram/front panel with the '\' C codes display. To do this, just right click on your string constant/control and select the '\' C codes display option. You should not see any \n or \r since for your string. When done, set the display to normal again. Hope this helps. /Mikael
0 Kudos
Message 3 of 9
(3,824 Views)
Thanks for your prompt answers. I have attached the VI file so that you can get a clear idea of what is the problem. This VI is to be integrated into a larger program. Please run the file with any inputs. Since I was not able to fix the problem I tried another approach, I wrote a C++ program that generates a text file with the commands. Integrating this code in Labview is not easy and was giving me some trouble (I didn't know wheter to use CIN's, ActiveX or DLLs, but I was advised to use DLLs).Anyway, I hope that the problem with the strings can be fixed, that would be a much easier and faster solution, if possible, I would like to have the whole program in Labview.
Thank you very much for your help.
Sincerely,
Javier
Download All
0 Kudos
Message 5 of 9
(3,824 Views)
Javier,

I think i have found the error, it comes when you use array to spreadsheet string function, which adds a line feed and a carriage return in the end. Even take them out in the output or use another function to translate your array, which can be a single numeric since it's only one element array.

Hope this helps you

Que tengas mucha suerte
Message 6 of 9
(3,824 Views)
Gorka,
Thanks a lot for your answer, you found the error. I am following your advice and I am working on fixing it. If I am not sucessful I will write you again.
Muchas gracias por toda tu ayuda.
Agur,
Javier
0 Kudos
Message 7 of 9
(3,824 Views)
I use the concatenate string quite frequently to do similar things in
LV 5.1 and 6i. The concatenate does not split the string at the a
comma. I tried it just now, and it works like it should. This must
be happenig somewhere else.



madrid2002 wrote in message news:<50650000000800000015220000-991728092000@quiq.com>...
> I have created a Labview program that generates a string of low level
> code to control a machine. For creating the string, I'm using
> Concatenate String, which combines different strings into one. My
> problem is that when I add a comma into the string, it automatically
> jumps to the next line, spliting the line into two. Example:
> - goal:
> data 60, -345
> - actual program:
> data 60
> , -345
>
> Does anyone know a way to solve this
problem?. The machine that I'd
> like to control with this commands is not able to understand the
> commands as they are now.
>
> Thanks in advance for your help.
> Javier
0 Kudos
Message 8 of 9
(3,824 Views)
The problem was solved. Mr. Gorka Larrea pointed out the source of the error. It comes from the function Array to spreadsheet string, which adds a return to next line after the last character. I fixed it using the Match Pattern function, which returns the substring before the cariage return (\r).
Thanks to everyone for the help provided.
Sincerely,
Javier
0 Kudos
Message 9 of 9
(3,824 Views)