I have a problem with passing a cluster of references to a subvi.
I want to create a logfile containing a list of all the values within my main program. This consists of three clusters, and 13 arrays. The clusters are 12 values each. The arrays are a mixture of 32 or 48 element arrays.
I have created a reference to each of the indicators, and used "Bundle by Name". (In fact, what I have to do, was "Bundle", and create a control to that Cluster. I then turned the control into a typedef, and replaced the "Bundle" with "Bundle By Name". If this is wrong, please tell me how else I can do this!)
So now I have a typedef ('InputRefs') which can be used as input to the WriteLogFile.vi. The error I have is:
Front Panel Terminal 'InputRefs': Hidden front panel control has undefined type (one for each element of the arrays.) If I open the typedef, I see the array icons within the Cluster have a small red 'x' within them. What's going on, and how do I fix this?
This is the kind of question we can't answer just by reading your paragraph.
Please attach your VI's so that we can see them while we try to read along with your description.
This is difficult. The main program is enormous, and I am taking values from all over to insert into the logfile Cluster. Is there any more information I can give you that will help?
I did write a tester vi to attempt to simulate the main program, maybe this will help.
as soon as I delete all those missing subVIs all errors are gone and your VI is runnable…
Ah, that is interesting, and explains why I didn't see the problem before. This is the first clue towards my problem, thanks for that!
The problem I was having perviously was to ensure that the input arrays were exactly of the correct size, something that LabView doesn't make easy.
So I added this subvi to increase the size of each array to the correct size. Is there a better way of doing this? How is this causing the error?
why do you need a loop?
Some more points:
- why is your "size" control set to U8 datatype? All those array functions expect the size as I32 value…
- my example is "simple" and suited for small array sizes. You might "improve" it by calculating the number of needed additional array elements first and only append them to your input array.
- your VI does not implement any error checking: what happens when the input array is bigger then your expected output array?
What do you mean by making an array the correct size? What is the correct size? What is an incorrect size?
Arrays can be whatever size they need to be. The subVI you posted doesn't make sense. It has two inputs, an array, and size of output array. The loop runs until i is equal to the size control. But loop iterations are zero based, so if size is 5, the loop will run 6 times (i=0,1,2,3,4,5). Then you building an array with that many zeroes on the end. Then you cut back the array. Why not just use Initialize Array and Replace Array subset?
None of this should be causing an error, but the error you describe doesn't make much sense. I think you'll just need to add code back in until the problem returns. Or take your original code and eliminate stuff until it goes away. Maybe then you can narrow down where the error is occurring.
To both of you:
This subvi is not intended for the final program, it is simply a way for me to verify that my logfileWriter was doing the correct thing. Efficiency is not important, although I like your solution, GerdW.
1) Size was set to U8 since I know the arrays are less than 255 elements. Setting them to I32 makes no difference.
3) Then it just returns an array of 'size of output array' elements, as it's supposed to. I don't really care about errors in this particular case. I only care about ensuring the array is of a particular size, and checking the output against that array.
What do I mean by the correct size? I mean the size I want the array. The correct size is 32, 48 or 8, depending on the array. It's a simple enough thing to want to do and I'm amazed that LabView doesn't give me any simple way of doing it.
I can't use Initialize Array since the point is to have an input control where I can put in some test values to ensure they are outputted correctly.
LabVIEW actually has "fixed size arrays". But I know they are meant for FPGA targets. I don't know if you can create them for Windows targets.
You can use Initialize Array to create an array of X number of elements. Then use Replace Array Subset to replace specific elements or a group of elements with other values.
But I don't think any of this has to do with the original error which lead you to ask the question. But I don't think we can help you solve that until you are able to post a VI that shows us that error.