01-20-2017 06:56 AM - edited 01-20-2017 06:56 AM
- Picture 1
1) What does the "width" (Blue color) do in Number To Decimal String function?
2) How does calculation work in String Length function?
3) Why do I need 2 TCP Read functions?
- Picture 2
1) What does the "offset" (Blue color) do in Search/Split String function do?
2) Again, why do I need 2 TCP Read functions?
My apologize if I ask too obvious questions because I'm trying hard to understand these functions but those jargons really bring me down. In case you're wondering, this is part of my assignment.
Solved! Go to Solution.
01-20-2017 07:24 AM
For most of your questions, what is it you don't understand in the Context Help explanations for your functions?
01-20-2017 07:36 AM
1. The width is the minimum number of characters to have in the resulting string.
2. I don't understand your confusion here. It is purely the number of bytes in the string.
3. A simple communication method is to first send the number of bytes in the message and then the message itself. So the first write is sending the number of bytes and the second write is the actual data. On the read side, you first read the number of bytes (I32, so 4 bytes) and use that to read the full message.
As already stated, most of your questions here can be answered by reading the context help and the full help.
01-20-2017 07:40 AM - edited 01-20-2017 07:42 AM
- Picture 1
1) For the "width", let's say the input number is 5 and the width is 3. Does it mean that the function will show like _ _ 5 and the number can only reach until 999?
2) I concatenate 1 boolean (1 byte?) and 1 number (1 bit?). Does the final number of length is 1.125 bytes?
3) For this question, I understand how TCP Write works but I just don't understand why do I need 2 of it.
- Picture 2
1) Even I read from the Context Help explanations, I still don't understand what does "offset" mean.
2) Same with Picture 1 - 3
01-20-2017 07:50 AM
A computer works with bytes. So you cannot have partial bytes in a data structure. Most integers are I32, meaning they are a number represented by 32 bits (4 bytes). The Boolean is actually represented by a single byte (0 is false, anything else is a true).
But in your case, we are converting a number into a human readable string with a minimum length of 3 characters (3 bytes minimum). So when you concatenate, your string will be at least 4 bytes in length.
And if you don't understand a function even after reading the help, make a small VI and experiment with the function until it makes sense.
01-20-2017 07:55 AM
@crossrulz wrote:
...
And if you don't understand a function even after reading the help, make a small VI and experiment with the function until it makes sense.
There you go!
One my early G-daddies told me "If you do not understand a fucntion, try "ctrl-n" ."
Ctrl-n is the short cut for "create new VI". One of the strong points of LabVIEW is that it is very easy to run a sub-VI with little effort.
Turn on the "ligth bulb" (execution highlighting) is also another goodw ayo to learn LV. When you get to the point where you can predict what you will see in execution highting mode... You will be "getting it".
Ben
01-20-2017 08:31 AM - edited 01-20-2017 08:55 AM
To put my two cents in - another strong point of LabVIEW is the easy creation of a SubVI from a selected part of the block diagram. My favorite way goes like this:
This makes life easy.
Some additional notes:
And another way ist to use the quick-drop feature: select the block-diagram element you want to explore, then press Ctrl+Space, then Ctrl+D. For every unconnected terminal a control or indicator will be created. I often use this with the "Match Pattern" function to test my RegEx.
01-21-2017 05:51 AM - edited 01-21-2017 05:53 AM
@Ben wrote:
@crossrulz wrote:
...
And if you don't understand a function even after reading the help, make a small VI and experiment with the function until it makes sense.
There you go!
One my early G-daddies told me "If you do not understand a fucntion, try "ctrl-n" ."
Ctrl-n is the short cut for "create new VI". One of the strong points of LabVIEW is that it is very easy to run a sub-VI with little effort.
Turn on the "ligth bulb" (execution highlighting) is also another goodw ayo to learn LV. When you get to the point where you can predict what you will see in execution highting mode... You will be "getting it".
Ben
Experimenting is one of my favorite ways of learning LabVIEW. The other way is by coming here and and asking questions. The OP has already made use of the second way; now it's time to use the first. 🙂
Sometimes I will take a new feature in LabVIEW and beat it with a stick until either I tame it, or I decide it's not immediately useful to me.
01-21-2017 09:16 AM
Appreciate your answers, guys! I can feel that the community is very kind enough to help each other. Cheers!