cancelar
Mostrando los resultados de 
Buscar en lugar de 
Quiere decir: 

Build a string with mixture of Text, number, space and enter

¡Resuelto!
Ir a solución

Hi all,

 

I am trying to build a string with mixture of Text, number, space and enter. The content and format of the string should be 'UOL0001 1 2 3' followd by an enter.

Please find it in the attachment, what I am trying to input is ' UOL0001\s1\s2\s3\n'. But it came out wrong. Any idea how to do it? Many thanks.

 

Sam

Descargar todos
0 kudos
Mensaje 1 de 9
4.395 Vistas
Solución
Aceptado por SamGao

Hi SamGao,


Check the following example. Even I don't know what is going wrong with the VI which you made. But to avoid that error, if you want to add a space (\s) or enter(\n) instead of typing it as such, after clicking inside the control just press space bar or enter key once. Then rightclick inside the control and select '\' codes display. Then you will see the \s and \n appearing in the indicator and the code will work fine.


Regards,

Nitzz

(Give Kudos to good Answers and Mark it as a Solution if your problem is Solved;)) 

Mensaje 2 de 9
4.391 Vistas

You're using "Normal display" on your strings, thus "\s" isn't interpreted but written as "\s". R-click the controls and change to "\\ Codes display"

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 kudos
Mensaje 3 de 9
4.379 Vistas

One curiosity is that you are using array to spreadsheet string?  Why are you doing this?  Why not simply use number to decimal string, for your decimal, and for your enter you can use the carriage return constant.  (these are on the strings menu). 

-Regards

eximo
_______________________________________________
UofL Bioengineering M.S.
Neuronetrix

"I had rather be right than be president" -Henry Clay
0 kudos
Mensaje 4 de 9
4.365 Vistas

Here I rewrote the code 

 

format strings.png

 

 

-Regards

eximo
_______________________________________________
UofL Bioengineering M.S.
Neuronetrix

"I had rather be right than be president" -Henry Clay
0 kudos
Mensaje 5 de 9
4.364 Vistas

don't forget to dole out some kudos to these guys, and mark this as a solution if it helps, if it doesn't, then try elaborating, we are here to help

-Regards

eximo
_______________________________________________
UofL Bioengineering M.S.
Neuronetrix

"I had rather be right than be president" -Henry Clay
0 kudos
Mensaje 6 de 9
4.361 Vistas

You might also consider Format Into String.  It's cleaner on the block diagram and easier to modify if you come back later.  The format string controls the output.  %s indicates a string, %d is a decimal number, %f is a floating point number and the .3 in front indicates I want a precision of 3 digits. \n prints a newline and the spaces between the %<> are printed as is.  There are many other options to the format string.


--Using LV8.2, 8.6, 2009, 2012--
Mensaje 7 de 9
4.347 Vistas

@eximo wrote:

Here I rewrote the code 

 

format strings.png

 

 


Or, you could just do this:

 

 

 

EDIT: I see that taper provided the alternative prior to me being able to finish my post - my post was stuck due to NI server problems.

Mensaje 8 de 9
4.341 Vistas

Many thanks, guys. The problem solved!

 

Sam

0 kudos
Mensaje 9 de 9
4.300 Vistas