LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array subarray question

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?

 

 

array subset.jpg

 

 

Any help would be appreciated

 

thank you

 

0 Kudos
Message 1 of 24
(6,052 Views)

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.

Message 2 of 24
(6,048 Views)

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.


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 3 of 24
(6,040 Views)

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.  

0 Kudos
Message 4 of 24
(6,022 Views)

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

 

 

0 Kudos
Message 5 of 24
(6,000 Views)

@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.  

Message 6 of 24
(5,976 Views)

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

string example.jpg

0 Kudos
Message 7 of 24
(5,953 Views)

You still have that build array function in there that turned your 1-D array into a 2-D array.  Get rid of that.

Message 8 of 24
(5,946 Views)

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:

snippet.png

Message 9 of 24
(5,941 Views)

oopppss...

 

I thought I had an aray subset function there...

 

Thanks for the heads up

0 Kudos
Message 10 of 24
(5,939 Views)