LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String Array Constant Addition

Is there an elegant way of marking the last element in a string array
constant? i.e. I take an Array constant, and add a simple string to it,
so that it becomes a String Array Constant. Now I add elements 1 and 2
and 3. But now I want to take element 3 out. If I just delete Element 3
contents from the string control, that is fine, but the # of Array
elements is still 3. It is just that the 3rd elelment is null. How can I
make the array length 2? Now I know that starting over is one option
(just creat a new array constant, and add the two elements) but what if
my array constant has 100 elements and I want to make it 99. I also
know that programatically I can remove these elelents, but I am taking
about in the programming of th
is constant. I must be over looking
something... Any ideas???


Sent via Deja.com http://www.deja.com/
Before you buy.
0 Kudos
Message 1 of 6
(2,633 Views)
lmc_rick@my-deja.com wrote:

> Is there an elegant way of marking the last element in a string array
> constant? i.e. I take an Array constant, and add a simple string to it,
> so that it becomes a String Array Constant

Arrays must be all the same type. If the last element is a constant, all
elements are

> Now I add elements 1 and 2
> and 3. But now I want to take element 3 out. If I just delete Element 3
> contents from the string control, that is fine, but the # of Array
> elements is still 3. It is just that the 3rd elelment is null.

In a string, yes, Empty strings are essentially nulls.

> How can I
> make the array length 2? Now I know that starting over is one option
> (just creat a new array constant, and add the two elements) but what if
> my array cons
tant has 100 elements and I want to make it 99. I also
> know that programatically I can remove these elelents, but I am taking
> about in the programming of this constant. I must be over looking
> something... Any ideas???

This is one of my problems. It is easy to size an array up, but hard to size
down.
Of course you can resize at run time but the only way I know to do this
when editing is to start over.

Kevin Kent
0 Kudos
Message 2 of 6
(2,633 Views)
> This is one of my problems. It is easy to size an array up, but hard to
size
> down.
> Of course you can resize at run time but the only way I know to do this
> when editing is to start over.

What I've started doing is using multiline string controls with scrollbars
instead of arrays, then reading the individual lines into an array at
runtime- these problems are bad enough, but try adding or deleting elements
from the middle of a large array and it's truly gruesome. 🙂
0 Kudos
Message 3 of 6
(2,633 Views)
hi,

To delete the last element of your array. Use the "Array Subset"
function. Wire the "array index" to 0 and "array length" to
(CURRENT_LENGTH - 1).

eric

In article <8n8n4j$oel$1@nnrp1.deja.com>,
lmc_rick@my-deja.com wrote:
> Is there an elegant way of marking the last element in a string array
> constant? i.e. I take an Array constant, and add a simple string to
it,
> so that it becomes a String Array Constant. Now I add elements 1 and 2
> and 3. But now I want to take element 3 out. If I just delete Element
3
> contents from the string control, that is fine, but the # of Array
> elements is still 3. It is just that the 3rd elelment is null. How
can I
> make the array length 2? Now I know that starting over is one option
> (just creat a new array constant, and add the t
wo elements) but what
if
> my array constant has 100 elements and I want to make it 99. I also
> know that programatically I can remove these elelents, but I am taking
> about in the programming of this constant. I must be over looking
> something... Any ideas???
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


Sent via Deja.com http://www.deja.com/
Before you buy.
0 Kudos
Message 4 of 6
(2,633 Views)
Sorry, I didn't fully underderstand what you were trying to do. Unless
you do this task programmatically, I don't think that this is possible.



In article <8n9d0m$a40$1@nnrp1.deja.com>,
ej wrote:
> hi,
>
> To delete the last element of your array. Use the "Array Subset"
> function. Wire the "array index" to 0 and "array length" to
> (CURRENT_LENGTH - 1).
>
> eric
>
> In article <8n8n4j$oel$1@nnrp1.deja.com>,
> lmc_rick@my-deja.com wrote:
> > Is there an elegant way of marking the last element in a string
array
> > constant? i.e. I take an Array constant, and add a simple string to
> it,
> > so that it becomes a String Array Constant. Now I add elements 1
and 2
> > and 3. But now I want to take element 3 out. If I just delete
Element
> 3
> >
contents from the string control, that is fine, but the # of Array
> > elements is still 3. It is just that the 3rd elelment is null. How
> can I
> > make the array length 2? Now I know that starting over is one option
> > (just creat a new array constant, and add the two elements) but what
> if
> > my array constant has 100 elements and I want to make it 99. I also
> > know that programatically I can remove these elelents, but I am
taking
> > about in the programming of this constant. I must be over looking
> > something... Any ideas???
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


Sent via Deja.com http://www.deja.com/
Before you buy.
0 Kudos
Message 5 of 6
(2,632 Views)
> Is there an elegant way of marking the last element in a string array
> constant? i.e. I take an Array constant, and add a simple string to it,
> so that it becomes a String Array Constant. Now I add elements 1 and 2
> and 3. But now I want to take element 3 out. If I just delete Element 3
> contents from the string control, that is fine, but the # of Array
> elements is still 3. It is just that the 3rd elelment is null. How can I
> make the array length 2? Now I know that starting over is one option
> (just creat a new array constant, and add the two elements) but what if
> my array constant has 100 elements and I want to make it 99. I also
> know that programatically I can remove these elelents, but I am taking
> about in the programming of this constant. I must be
over looking
> something... Any ideas???
>

It is possible to do this to the control, but not elegant or easy. It will
take about six or so clicks. The good news is that the next version of LV
allows you to click on the element in the array, popup, and under Data
Operations, Choose Delete Element or Insert Element. The same thing
works for rows and columns on 2D arrays.

Greg McKaskle
0 Kudos
Message 6 of 6
(2,631 Views)