LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create multiple Enum constant without doing it manually one by one?

First question.  Why do you need 1000 constants?  What are you going to do with them all?

 

Second question.  Can you create 1, then copy it.  Then select the 2, then copy them.  Then select 4 and copy them.  Don't create 1000.  Create, copy.  Select, copy.  Keep doing that and you'll exponentially create the 1000 you need in only a handful of steps.

 

Third question.  Have you looked into scripting yet like earlier posts have said?

 

Fourth question.  Instead of 1000 individual constants, why wouldn't you have just one array of constants with 1000 elements?

 

But until there is a good answer to the first question I asked above, it will be hard to give you a good answer to the quesiton you asked in your subject line.

Message 21 of 30
(1,067 Views)

@RavensFan wrote:

First question.  Why do you need 1000 constants?  What are you going to do with them all?

 Sorry, i mean I don't need 1000 constants but roughly, if I need multiple constants.

Second question.  Can you create 1, then copy it.  Then select the 2, then copy them.  Then select 4 and copy them.  Don't create 1000.  Create, copy.  Select, copy.  Keep doing that and you'll exponentially create the 1000 you need in only a handful of steps.

That's what I thought at first but when asked, my supervisor doesn't want the trouble to copy and paste constants multiple times.

 

Third question.  Have you looked into scripting yet like earlier posts have said?

I did try to look at scripting but am still unsure

 

Fourth question.  Instead of 1000 individual constants, why wouldn't you have just one array of constants with 1000 elements?

 Didn't think of that when i started

But until there is a good answer to the first question I asked above, it will be hard to give you a good answer to the quesiton you asked in your subject line.


 

0 Kudos
Message 22 of 30
(1,053 Views)

I have some more questions, regarding to the screenshot of that spagetthi-monster, "Menu9h_editable.vi":

  • Do not use a local variable to get value from a control, especially when your control is just right there. Connect the wire to the control itself! You free up lots of space, and might avoid other problems.
  • Lots of Rube Goldberg things in this screenshot, for example you create a cluster and an array from your enums. You know that, you can convert a cluster into an array using just a simple function?
  • That FOR loop has an incoming array wire set to autoindex the loop. So why you set the iteration terminal to 1000? That for loop will just work fine without that value.
  • There is that small While loop before the large one. You did not set any wait function inside, it hammers your CPU, your PC tries to run this loop as fast as possible for no reason. Why you need that while loop there?
  • What is the task of this program?
  • Is it a VI you programmed yourself, or done by your supervisor?

If the answer for the last question is that this VI was done/started by your supervisor, or he/she saw it and did not guide you how to refactor the whole thing, I strongly advice you to find another LabVIEW tutor.

Either way, I beleive you would strongly benefit going through the LabVIEW Core 1 self-paced online training. Learn about the basics, and at the end of the course about State Machines...

0 Kudos
Message 23 of 30
(1,049 Views)

@Blokk wrote:

I have some more questions, regarding to the screenshot of that spagetthi-monster, "Menu9h_editable.vi":

  • Do not use a local variable to get value from a control, especially when your control is just right there. Connect the wire to the control itself! You free up lots of space, and might avoid other problems.
  • Lots of Rube Goldberg things in this screenshot, for example you create a cluster and an array from your enums. You know that, you can convert a cluster into an array using just a simple function?
  • That FOR loop has an incoming array wire set to autoindex the loop. So why you set the iteration terminal to 1000? That for loop will just work fine without that value.
  • There is that small While loop before the large one. You did not set any wait function inside, it hammers your CPU, your PC tries to run this loop as fast as possible for no reason. Why you need that while loop there? That while loop has nothing to do with the program....It was me testing something out
  • What is the task of this program? Not explained in details by my supervisor
  • Is it a VI you programmed yourself, or done by your supervisor?It's done by my supervisor 

If the answer for the last question is that this VI was done/started by your supervisor, or he/she saw it and did not guide you how to refactor the whole thing, I strongly advice you to find another LabVIEW tutor.

Either way, I beleive you would strongly benefit going through the LabVIEW Core 1 self-paced online training. Learn about the basics, and at the end of the course about State Machines...

 


 

0 Kudos
Message 24 of 30
(1,045 Views)

Hmm, I do not know the local situation, why you need to do this, is it a trainee or student position, etc. But clearly this supervisor either lacks the proper LV skills or just in general has strange way to "teach". If I was you, I would try to get more details about what actually your supervisor wants you to do.

But in order to understand what kind of task actually you need to do with LabVIEW, and formulate proper questions which make sense here in the forum, you need to learn more! Depending on your licence type (check it out at your local IT center, if you are a student, you are also eligible to access NI online teaching material) you might have access the Core online trainings: http://ni.com/myni/self-paced-training

Also check this out: http://www.learnni.com

Think about it as a personal learning project, independent of that task your supervisor wants you to do...

0 Kudos
Message 25 of 30
(1,040 Views)

@Blokk wrote:

Hmm, I do not know the local situation, why you need to do this, is it a trainee or student position, etc. But clearly this supervisor either lacks the proper LV skills or just in general has strange way to "teach". If I was you, I would try to get more details about what actually your supervisor wants you to do.

But in order to understand what kind of task actually you need to do with LabVIEW, and formulate proper questions which make sense here in the forum, you need to learn more! Depending on your licence type (check it out at your local IT center, if you are a student, you are also eligible to access NI online teaching material) you might have access the Core online trainings: http://ni.com/myni/self-paced-training

Also check this out: http://www.learnni.com

Think about it as a personal learning project, independent of that task your supervisor wants you to do...


I'm currently a student tasked to do this project done by him. But thank you for taking your time to answer my silly questions. Really appreciate it:) I'll look up the links you've provided.Thanks again.

Message 26 of 30
(1,032 Views)

Some more advices: try to keep your VI not too large in term of screen size. Learn how to use subVIs, and get more familiar with certain LV functions in the palette. Turn on the "Context Help", you will find it at the top right of your VI window, it will give you descriptions of the functions, etc. When you start to work on your VI, try to go step by step. For example, you can even make smaller "test" VIs just to test out an idea you have, and integrate it later into the main VI. Whenever you have a specific question, post it here in the forum. Very important: attach your VI and not a screenshot! Also, explain properly in details, what is your goal, what you tried so far, and what you find problematic. In this way you will get faster and better help!

Some more useful readings for beginners: http://www.ni.com/newsletter/51735/en/

0 Kudos
Message 27 of 30
(1,029 Views)

@Blokk wrote:

Some more advices: try to keep your VI not too large in term of screen size. Learn how to use subVIs, and get more familiar with certain LV functions in the palette. Turn on the "Context Help", you will find it at the top right of your VI window, it will give you descriptions of the functions, etc. When you start to work on your VI, try to go step by step. For example, you can even make smaller "test" VIs just to test out an idea you have, and integrate it later into the main VI. Whenever you have a specific question, post it here in the forum. Very important: attach your VI and not a screenshot! Also, explain properly in details, what is your goal, what you tried so far, and what you find problematic. In this way you will get faster and better help!

Some more useful readings for beginners: http://www.ni.com/newsletter/51735/en/

I'll do that.Thanks again for your help!

Message 28 of 30
(1,020 Views)

@Unsure wrote:

@RavensFan wrote:

First question.  Why do you need 1000 constants?  What are you going to do with them all?

 Sorry, i mean I don't need 1000 constants but roughly, if I need multiple constants.

Second question.  Can you create 1, then copy it.  Then select the 2, then copy them.  Then select 4 and copy them.  Don't create 1000.  Create, copy.  Select, copy.  Keep doing that and you'll exponentially create the 1000 you need in only a handful of steps.

That's what I thought at first but when asked, my supervisor doesn't want the trouble to copy and paste constants multiple times.

 

 

1.  500, 1000, 2000, "roughly" 1000, it really doesn't matter.  I don't care about he exact number.  What is the purpose of creating a large number of constants?

2.  So your supervisor tells you to create some large number of constants and doesn't tell you why or what is going to be done with them.  You are looking for an easier way to do this and propose a pretty easy way that would only take a minute to do, but he "doesn't want the trouble to copy and paste constants multiple times".  Sorry, but that person is an idiot.  You've already spend more time asking the question then it would have it if had just gone and done the copy/paste operation.

 

I wish you lots of luck in your programming endeavors when the person leading you doesn't provide any information other than really bad information.Smiley Frustrated

 


 

Message 29 of 30
(995 Views)

I agree with RavensFan, but I think the OP should be careful in this situation. A professor can badly affect a student's life if he/she wants to... I really advice a parallel approach to this student: first, try to get more explanation about the deliverable task from this supervisor in a diplomatic way. Second, start to learn LV deeper, using the accessable resources.

 

Unsure: start with the Core 1 online training, you can go through it in 1 week. If you have questions during the way, ask them in this forum (but first search for keywords, it often happens others already asked them in the past). When you get more familiar with LabVIEW, it will give you two benefits: you can formulate your questions better in the forum, but you will also be able to argue against nonsense tasks if a professor throws you such...

0 Kudos
Message 30 of 30
(979 Views)