11-13-2015 11:17 AM
I am new to Labview and am trying to view a subset of a string of data into an array.
I am able to create the array Channels but I would like to have an array that starts
with the 14th element of channels that is 128 elements long.
I tried the following but the subarray indicator doesdisplay any data other than 0.
What am I doing wrong?
Any help would be appreciated
thank you
11-13-2015 11:21 AM
The "Build array" function you are using creates one element per input. Since you only have one input, anything other than index 0 will be a zero.
11-13-2015 11:27 AM
LV-rookie wrote:
I am able to create the array Channels
Channels is NOT an array. It is a single (scaler) value. You probably want to use an array for your data type for the Unflatten From String.
11-13-2015 12:32 PM
As others have said Channels is a scalar number. It is a single I16 numbers. A number that can be represented as 16 bits. The display format of the control will be in decimal by default but can show other things. So even if you were thinking your single number is 16 bits, how would you get 128 of them starting at 14? There isn't 128 of them to get there is a maximum of 14.
What you need to do is post an example string, which goes into the Unflatten From String, and describe what you want the output to be. We can then describe the functions needed, and what each one does.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
11-13-2015 01:05 PM
Thanks for all the responses...
So I will change the type of my unflatten from string to an I16 array.
Do I need to specify (the greater than 128) elements for that type or is an array type enough?
Regarding the subarray subset funtion, I was under the impression that this would take the 14th element of
channels and dump that element and 127 more into the subarray. If I change the type of my unflatten from string
to an I16 array will this be the case?
best regards
11-13-2015 01:43 PM - edited 11-13-2015 01:44 PM
@LV-rookie wrote:
Regarding the subarray subset funtion, I was under the impression that this would take the 14th element of
channels and dump that element and 127 more into the subarray.
It will if there are 14 elements in your array. But your array as you posted contains one element. Channels is a single value, not multiple values.
Again, what you need to do is post an example string, which goes into the Unflatten From String, and describe what you want the output to be. We can then describe the functions needed, and what each one does.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
11-13-2015 02:48 PM
OK, so I am including the VI with this reply. I have set up a string as a constant but will later be readinig this from a file (TBD)
but just want to make sure that I have the basics of how to take a subset of a string and use that to create another string.
When I went to create the indicator subarray2 it makes it appears to have created a 2 dimensional array, but not sure why that it...
Thanks
11-13-2015 02:57 PM
You still have that build array function in there that turned your 1-D array into a 2-D array. Get rid of that.
11-13-2015 03:04 PM
I feel fairly certain that unflattening from a string isn't what you really want to do. I think you want to convert each group of 4 into a hex value. Like so:
11-13-2015 03:05 PM
oopppss...
I thought I had an aray subset function there...
Thanks for the heads up