Michael Malak Posted May 15, 2009 Report Share Posted May 15, 2009 OK, so now I've decided to have an array of references to 12 WaveGraphs. And it works. For the sake of keeping the diagram clean, I would like to separate the initialization of this array from the use of the array. But when I right-click on the output of the Build Array VI, the option "Create Local Variable" is not available. Is there an alternative to wiring the array directly to where it is being used, or is there some way I can separate my initialization code from my event-handling code? Quote Link to comment
Neville D Posted May 15, 2009 Report Share Posted May 15, 2009 Why don't you post a quick snapshot of what you mean? There is no need to "initialize" an array in LV. Using Local Variables of an array is a bad habit to get into. (Race conditions, calls to memory manager affect performance, creates unnecessary copies of data). Maybe a quick look at the Getting Started with LV manual would help. N. Quote Link to comment
Michael Malak Posted May 15, 2009 Author Report Share Posted May 15, 2009 QUOTE (Neville D @ May 14 2009, 03:32 PM) Why don't you post a quick snapshot of what you mean?There is no need to "initialize" an array in LV. Using Local Variables of an array is a bad habit to get into. (Race conditions, calls to memory manager affect performance, creates unnecessary copies of data). Maybe a quick look at the Getting Started with LV manual would help. N. I should have mentioned that it was what I decided upon at the end of this thread: http://forums.lavag.org/Instantiate-WaveGr...aded#entry62912 In a nutshell, I need 12 WaveGraphs, independently controlled (including zoom), yet treatable as an array. So I am using an array of 12 references to 12 independent WaveGraphs. The attached diagram shows my current solution, which is to wire the array of references directly to where it is needed in the event loop. Quote Link to comment
jcarmody Posted May 15, 2009 Report Share Posted May 15, 2009 My signature is my answer to local variables. :thumbdown: Quote Link to comment
Mark Yedinak Posted May 16, 2009 Report Share Posted May 16, 2009 If you want help you will need to post either a more complete snapshot of your VI or the code itself. From the tiny snippet you posted it is hard to see what you are doing. Not to sound nasty of anything but I would suggest that you take the LabVIEW Basics I and II courses or at a minimum pick up the book "LabVIEW for Everyone". You would benefit greatly from some training to help get you started. While LAVA is a great source of information it is not the best place to try and learn LabVIEW from the ground up. There are better resources for that. Quote Link to comment
jdunham Posted May 16, 2009 Report Share Posted May 16, 2009 QUOTE (Michael Malak @ May 14 2009, 02:57 PM) http://forums.lavag.org/Instantiate-WaveGr...aded#entry62912In a nutshell, I need 12 WaveGraphs, independently controlled (including zoom), yet treatable as an array. So I am using an array of 12 references to 12 independent WaveGraphs. The attached diagram shows my current solution, which is to wire the array of references directly to where it is needed in the event loop. One thing no one suggested was subpanels. It's kind of an advanced LabVIEW topic, and I wouldn't normally recommend it for a self-proclaimed new user, but I think it gets you closest to what you need. You can't have an array of subpanels, but you can drop 12 of them on your panel. First I would try it with two and see if it's feasible. Here's what you could do: 1. Drop the Subpanel controls on your front panel and arrange them. 2. Make a new VI with your graph on the front panel, and select Fit Control to Pane by right-clicking on the graph. 3. Make this VI reentrant in the VI Properties -> Execution. This will enable you to create clones of your panel. 4. Run Open VI Reference with Options = "8" once for each graph you need, and then pipe those references into the SubPanel nodes on your diagram. 5. Figure out some way to get the data into your cloned panels (there are lots of ways). You could use notifiers named for each clone name, or else you could obtain the control references for each with a few VI server calls and then send data into the Value property of those control refs. Oh curse the day I read your post, Michael Malak! It was an interesting problem, so I had to code it up. I didn't close any references (probably doesn't matter), nor handle any errors (there are none), and I only added comments where the code was completely obscure. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.