GregSands Posted June 25, 2018 Report Share Posted June 25, 2018 Does anyone know of a way to create a single (default) element of an arbitrary-dimension array? I'm trying to create some Malleable VIs which have the same code for 1D-3D arrays, but have different code for floating-point vs integer arrays. A second possible use in Malleable VIs would be to Initialize a new array based on an input array. Any thoughts from anyone? Quote Link to comment
Popular Post smithd Posted June 26, 2018 Popular Post Report Share Posted June 26, 2018 (edited) reshape array + index, inside of a diagram disable structure reshape array takes any dim array and returns 1-dim array. Index takes 1dim array and returns element. Disable structure makes sure the code doesn't run and that you always get the default value for the data type. any aggregation function (add array elements, array max and min, etc) will work too, but I think the reshape/index is clearer. Edited June 26, 2018 by smithd 3 Quote Link to comment
GregSands Posted June 26, 2018 Author Report Share Posted June 26, 2018 Oh, very nice! I'd not wanted to use Reshape Array because of the memory re-allocation, but I didn't think of using it in a Diagram Disable Structure. if I ever meet you in person... 1 Quote Link to comment
GregSands Posted June 27, 2018 Author Report Share Posted June 27, 2018 So this gets a little more interesting with the output type of the DDS: 1.Following directly with a VIM causes the output to back-propagate from the VIM's default input type. 2.This does not happen if the Types Must Match is used directly, even though this is essentially the contents of the VIM. 3. Wrapping a sequence around either the DDS or the VIM causes the type to be defined correctly. 4. Putting the DDS inside its own VIM also solves the problem, but only if there is also a sequence wrapping the DDS inside - if not, then the output type from the DDS VIM is always its own default output type. In any case, here's the Default Element VIM (saved for 2012) for any who might use it. Default Element.vim Quote Link to comment
smithd Posted June 28, 2018 Report Share Posted June 28, 2018 what? @Aristos Queue may be interested in and/or be able to shed light on how to do this better? Quote Link to comment
Aristos Queue Posted August 3, 2018 Report Share Posted August 3, 2018 On 6/27/2018 at 5:14 PM, GregSands said: So this gets a little more interesting with the output type of the DDS: ... In any case, here's the Default Element VIM (saved for 2012) for any who might use it. Default Element.vim This turned out to be surprisingly easy to fix. The fix will be included with LV 2018 SP1. The problem is that there are a very few nodes in LV that reach downstream to get their types when they think it is safe to do so as a way of giving better default types for terminals. But when the downstream terminal is something polymorphic, that has to be limited or disallowed. I never knew about that feature of LV (though I've unconsciously taken advantage of it many times, it turns out). I just needed to add a downstream malleable VI to the disallowed list so that the malleable is always driven by upstream instead of driving upstream. 2 Quote Link to comment
GregSands Posted August 3, 2018 Author Report Share Posted August 3, 2018 Great, thank you AQ. 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.