LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Strings in array

Hello everyone. I have made a serial port block diagram in Labview, to make some measurement in my scale. The scale is connected with a serial port connection to my PC. The block diagram is a basic serial write and read diagram, so i have to make a array to enter my different commands from my scale. How do i make that array in this case ?

 

I have uploded the VI.

 

Thanks in advance

 

Oesen

Best regards

Oesen
0 Kudos
Message 1 of 7
(3,344 Views)

Without knowing the commands, there's not much we can do to help.

 

Do you really need an array of strings?  Or just a case structure that outputs a string?

 

Look inside of the String palette.  There's all kinds of fun functions for parsing, building, and converting to/from strings.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 7
(3,315 Views)

Right now you have a completely empty array - a shell that doesn't contain any data.  You need to drag some type of control - such as a string - into the array control to make it into an array of strings.

0 Kudos
Message 3 of 7
(3,301 Views)

Perhaps this might be what you are looking for?

0 Kudos
Message 4 of 7
(3,280 Views)

Thanks for the replies 🙂

 

Sorry i can't open the the file because it is 2011 version of Labview, and i have the 2010 version :(. But i have a lot of commands :

 

PRT\r\n = Reading the value in gram

 

ON\r\n = ON state for the scale

 

OFF\r\n = OFF state for the scale

 

I can't remember anymore, but i have to make a program, where i can choose one of the commands i want in the array and run the program. So i can make measurements for the scale with using all those commands in a easier way 🙂

Best regards

Oesen
0 Kudos
Message 5 of 7
(3,267 Views)

Will you consider a different approach?  Create an enumeration (which should be a type definition) containing all of the commands.  Put the enumeration control on the front panel so you can select the command easily.  Wire the enumeration value into "Format Value" which will get you the corresponding text; as a format string use "%s\r\n" (without the quotes).

0 Kudos
Message 6 of 7
(3,263 Views)

@nathand wrote:

Will you consider a different approach?  Create an enumeration (which should be a type definition) containing all of the commands.  Put the enumeration control on the front panel so you can select the command easily.  Wire the enumeration value into "Format Value" which will get you the corresponding text; as a format string use "%s\r\n" (without the quotes).


A slightly different flavor to this one is create a string with multiple lines, each line being a command. Then use "pick line from string" function and create an enum to wire up to the "line" input. This way, if the command text isn't very meaningful as far as letting the programmer of the device know what the command actually does, you can create an enum with meaningful text which will index the proper command to send to the device. You could also take a similar approach to this with index array, if you don't favor the multiline string.

 

0 Kudos
Message 7 of 7
(3,242 Views)