LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to rename the for loop variable i ?

Solved!
Go to solution

I do a lot of work with 2 D arrays.  Sometimes it would be helpful when stepping through arrays to have one of the indexes named i and the other named j.  Is there a way to change the name of the increment variable other than making it into another variable?

 

Thnaks.

0 Kudos
Message 1 of 9
(3,279 Views)

This is how I work with 2D arrays. Could you point to the variables you want to name?

 

Message Edited by Dennis Knutson on 04-03-2009 01:44 PM
0 Kudos
Message 2 of 9
(3,266 Views)

While that is great for reading every element of a 2D array, I personally find the iteration count useful for several reasons. This could be a lack of programming, but if I wanted to programmatically vary an interval to read in the array, I wouldn't know how to do that without the iteration terminal.

 

For example: read every 5th element for 20 elements, then every 7th for 30, then  allow the user to decide through a control.

 

Again, I just may be overlooking something (as is the general barrier with coding) but when I find the iteration terminal useful is with very "customized" indexing. 

 

As far as the solution, creating a variable or hidden indicator with a different name would be a fairly simple fix.

Chris Van Horn
Applications Engineer
0 Kudos
Message 3 of 9
(3,248 Views)

Chris,

 

I don't disagree but I thought the request of the op was just a little bit silly since it is the wire that is the variable and you can place any label you want on the wire and if using controls for indexing, they canbe named anything at all.

0 Kudos
Message 4 of 9
(3,243 Views)

 Is there a way to change the name of the increment variable other than making it into another variable?

 

Sure.  You have to remember that in LabVIEW, a variable is a wire.  The little boxes on the ends of wires are not variables, but terminals.

 

Think of a WIRE as a variable, and you'll have no problem.

 

Then you can name it "i" or "j' or "Schwarzenegger" and do whatever you like with it. 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 5 of 9
(3,227 Views)

CoastalMaineBird wrote: 

Then you can name it "i" or "j' or "Schwarzenegger" and do whatever you like with it. 


 

 
I personally make it a point to name all my wires "Schwarzenegger".

 

0 Kudos
Message 6 of 9
(3,219 Views)

If you put a label by the wire, and then use ctl"u", the label moves to a different part of the screen and is no longer associated with the wire.  I need some way to keep track of row col when I am managing arrays ...  I don't know  how to "name" the wire a "name" and keep that available to me when I need to figure out what the "wire" is, if it is coming from an iteration counter.  I didn't want to create a variable with an indicator from the iteration counter...I could name that and keep track that way but it would slow things down.

 

Isn't there some way to name the i a j or an m or an n or something like that so the iteration count can be like other "languages"...(Please don't start on the vision thing...when you get old, and the icons will not change size unless you zoom your entire screen, sometimes it is nice to have the name of the variable (like after a multiplication that you name something)).

 

Just asking.

 

Thanks.

0 Kudos
Message 7 of 9
(3,218 Views)

Isn't there some way to name the i a j or an m or an n or something like that so the iteration count can be like other "languages

 

No. 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 8 of 9
(3,213 Views)
Solution
Accepted by Hummer1

Hummer1,

 

As stated before, there is no way to change the image of the iteration terminal.  However, you can add a description to the wire.  Right click the wire, and select "Description and Tip", then type the name/description you want in the box.  Now you can move your mouse over the wire, and the description will appear in the Context Help window.  Hopefully, this helps.

 

Chris M 

0 Kudos
Message 9 of 9
(3,207 Views)