07-19-2018 09:14 PM
Hi,
I have this cluster of 2 array elements: X and Y. I'd like to programmatically decrease a couples of elements in the Y array by 1 every time the for loop runs. I'm thinking about using hardcoded indices and the Replace Array Subset primitive to change the elements of the Y array, but then I realized this approach is not working for my program since I want to do the same thing to an array of another cluster at different indices. Is there a way to do this in more generic way?
Thank you for any help!
MV
Solved! Go to Solution.
07-19-2018 09:50 PM
So this is what I came up with so far. It's not generic so I can't use this in case the elements of the array are at different location.
07-19-2018 10:43 PM
You'd turn this into a subVI. But don't "hard-code" the index. Make it a control on the subVI connector panel.
Then for each array, you run it through this subVI and wire a constant to the input of the subVI.
07-20-2018 03:12 AM
Why are you unbundling the same Y element twice? Once is enough!
Use "in place element" structures to unbundle and replace array elements.
Why are you creating these datastructures (array of clusters of arrays with mostly redundant elements) at the autindexing output tunnel. Wouldn't it be sufficient to process everything inside the loop?
07-20-2018 10:51 AM
Hi RavensFan and altenbach,
Thank you for the replies. As you guys' suggestions I modified my VI a little bit to make it work with different cases, but it's getting a little bit complicated. Would there be a better way to do this?
@altenbach wrote:Why are you creating these datastructures (array of clusters of arrays with mostly redundant elements) at the autindexing output tunnel. Wouldn't it be sufficient to process everything inside the loop?
I'm trying to do is that I have about 22 band pass filter waveform, all of which have the same shape but different gain and I want to check if the waveform are within the set limit. So I'm creating an array for these waveform, use the auto-index to check it with the limit clusters (there are upper and lower limits) and only the pass band should be decreased by 1 for each iteration. Btw, I'm feeding these limit clusters to the limit specification vi under the waveform palette then use the limit testing vi to check the limit with my filter waveform.
07-20-2018 11:12 AM
07-20-2018 11:37 AM
I did give me the correct result.
Maybe the attached vi can better explain what I want to do. I don't need save the graphs. I just want to know if all the waveform pass the limits I set. If it does fail, then save the graph at an image (I haven't implemented this function yet). I put the 3s wait in the for loop just for debugging purpose. This is how one of the output waveform looks like
07-20-2018 12:19 PM
(posting by phone, cannot look at vi)
Why can't you just create arrays of limits and compare the data directly?
07-20-2018 12:55 PM
Can you explain more on what you mean by "array of limits"?
07-20-2018 01:05 PM
OK, looked at your last VI, which has no resemblance to the previous discussion. (we also don't have any data files!). So what's wrong with using the built-in limit testing?