LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Delete element from array without Local Variable

Solved!
Go to solution

I am wanting to know if you can delete an element from an array, index the deleted portion,

and update the value of Array to not include the deleted portion in a more direct way than the following:

 

1.JPG 

 

Or, in my program, the array is initialized with certain indices which makes the task of removing an element from

 the array, indexing the deleted portion, and updating the array to not include the deleted portion similar to the following:


 2.JPG

 

a) Is there a way to do this without having to use Local Variables?

b) Should I be so concerned about ridding my program of all Local Variables? (even ones that don't create race conditions)

 

 

 

 

 

 

 

 

 

0 Kudos
Message 1 of 11
(2,904 Views)
Solution
Accepted by topic author goodnaysayer

Keep the array in a globally initialized feedback node. Don't involve front panel objects.

0 Kudos
Message 2 of 11
(2,898 Views)
Of course "delete from array" should bever be used repetitively in a tight loop. Try to do an inplace solution instead. I am currently psting via phone, but do a forum search for details.
0 Kudos
Message 3 of 11
(2,891 Views)

"Keep the array in a globally initialized feedback node. Don't involve front panel objects."

 

I suppose I need to include the fact that this is happening in an event structure where this happens for different events, not for each iteration of a loop.

0 Kudos
Message 4 of 11
(2,886 Views)

@goodnaysayer wrote:

I suppose I need to include the fact that this is happening in an event structure where this happens for different events, not for each iteration of a loop.


Same difference. Show us more code so we can be more helpful ;).
0 Kudos
Message 5 of 11
(2,884 Views)

I don't mean to come off as being obstinate, but, since my code works using the method shown (and this is a very small part of the program), my main question is really:

 

"Is there a reason why I should take the time to do this another way?" (i.e. without using Local Variables in the way specified in the sample code provided)


0 Kudos
Message 6 of 11
(2,880 Views)

Speed, memory usage and possibly avoiding race conditions. Learning better coding techniques is another good reason. But if it does what you need it to do then why bother. If you know how to use shift registers then you know how to use feedback nodes. They are kind of the same thing but without the loop.

=====================
LabVIEW 2012


Message 7 of 11
(2,870 Views)

Well, I suppose I will not worry about this then. I may come back to this in time -- this phase of the project will be fluid until summer.
If I do come back I now know to start by reading over feedback nodes.
 

Thanks for the help.

0 Kudos
Message 8 of 11
(2,862 Views)

Feedback nodes are really cool things. Local variables - not so much Smiley Very Happy

 

But seriously local variables do have their uses. This is just not the best use.

 

Also, Altenbach should get the solution. I answered a different question Smiley Very Happy

=====================
LabVIEW 2012


Message 9 of 11
(2,858 Views)

If there were only a way to have multiple solutions.... I have a tendency to mark the solution of the last question instead of the initial... 


Forgive me, Altenbach.
Forgive me, Steve.

Kudos all around. 

Message 10 of 11
(2,854 Views)