Aitor Solar Posted July 11, 2008 Report Share Posted July 11, 2008 I find surprising that the Initialize Array function doesn't allow for an array input. It would be really helpful for creating multidimensional arrays where not all elements are the same. Of course the same can be done with a for loop, but doesn't feel so clean. Saludos, Aitor Quote Link to comment
Francois Normandin Posted July 11, 2008 Report Share Posted July 11, 2008 Perhaps you could propose an OpenG "Initialize nD Array". :thumbup: Quote Link to comment
crelf Posted July 11, 2008 Report Share Posted July 11, 2008 QUOTE (Aitor Solar @ Jul 10 2008, 07:39 AM) I find surprising that the Initialize Array function doesn't allow for an array input. So you're trying to initialize a 2D array where each row is [0,1,2] - the change you're proposing would require the ability to select between rows and columns. I don't find it surprising that functionality doesn't exist, as I've never seen a usecase for it. That said, if you do have one, let NI know as a feature request. Quote Link to comment
Aristos Queue Posted July 11, 2008 Report Share Posted July 11, 2008 Here's another way you could do it that would be more efficient. Quote Link to comment
Darren Posted July 11, 2008 Report Share Posted July 11, 2008 How strange...yesterday, for the first time in my life, I attempted to wire an array to Initialize Array (and got a broken wire, and wondered why it wasn't allowed). Then I discovered this thread today... -D Quote Link to comment
JiMM Posted July 11, 2008 Report Share Posted July 11, 2008 Sorry to go off topic (didn't feel that this deserved a seperate thread), but last week I realized that there is something missing from the basic I/O primatives. Why is there no GPIB query? It seems that this function should be available in a primative rather than having to be built up from a seperate read and write. I only have 6.0, 7.1, and 8.0 so maybe it has been added in a later version. Quote Link to comment
Yair Posted July 12, 2008 Report Share Posted July 12, 2008 QUOTE (Aristos Queue @ Jul 10 2008, 10:01 PM) Here's another way you could do it that would be more efficient. OK, so now I gotta ask, did you place the array outside the loop on purpose? The only difference I can see between the two methods is that the array is folded before the loop, but since the entire loop is folded, I assume that means that the array inside the loop is folded as well and therefore having the array outside the loop should not have any advantage. Quote Link to comment
Aitor Solar Posted July 12, 2008 Author Report Share Posted July 12, 2008 Well, the [0,1,2] array was just an example, obviously consecutive arrays can be generated easier but I was referring to any kind of array. Say you have a boolean array defining different properties of an object. You would like to generate n copies of the default configuration array for n objects in your application and treat them as a 2D array for easy comparison. Sure this woundn't be a essential modification, since is the first time I have encountered this problem in all these years, but still it would be useful in some cases. Saludos, Aitor BTW, when testing if the initialize array function admits a cluster with an array inside (it does) I have discovered that if you take a waveform constant and try to duplicate the cluster elements inside the cluster, LV crashes. Funny. Quote Link to comment
torekp Posted July 12, 2008 Report Share Posted July 12, 2008 I do this kind of thing fairly often, so here are the VIs I've created for the purpose. I'm sitting at a Labview-less computer right now, so I can't check to see if these call any of my other VIs, but I don't think they do. Labview 8.5.1 Quote Link to comment
Aristos Queue Posted July 12, 2008 Report Share Posted July 12, 2008 QUOTE (Yair @ Jul 11 2008, 04:52 AM) OK, so now I gotta ask, did you place the array outside the loop on purpose? Nope. In this case, inside or outside the loop would be the same. I was just posting the diagram where I had generated both to prove to myself that they really did output the same thing. 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.