03-11-2009 12:27 PM
"Constrained Nonlinear Curve Fit.vi" requires some other VI implements the form of the model that is to be fit, and needs a reference to that VI as one of its inputs.
It seems like there are multiple kinds of references to VIs - why? What are they and how do you know which to use?
I've attached a vi that does curve fitting with the above mentioned vi, and it also sets up the reference to the other vi which contains the model, also attached. Per the comments, I thought some simple reference pointing at the model vi would be all it needs, but it seems to need a dynamic reference to that which has been modified by typecasting to another type of vi reference. At least, if I understand this right.
Can anybody shine the light on this or aim me at someplace helpful? Notice I have already seen some context help for creating references to vis.
That's where I got my instructions.
Solved! Go to Solution.
03-11-2009 12:28 PM
03-11-2009 12:39 PM
03-11-2009 12:43 PM
cebailey,
If you right click your Static VI Reference and select "Strictly Typed VI Reference", then you will be able to wire it into the Constrained Nonlinear Curve Fit VI. The Curve Fit VI uses a Call by Reference Node, which only accepts strictly type references (specific to a particular connector pane).
Here is some more information from the LabVIEW Help about Static VI References:
http://zone.ni.com/reference/en-XX/help/371361E-01/glang/static_vi_ref/
Chris M
03-11-2009 01:26 PM - edited 03-11-2009 01:27 PM
Seems you got your answer already. 🙂
As an additional comment you would save yourself a lot of work leaving optional terminals disconnected. Connecting diagram constants with default values just clutters the diagram unless you plan to change them later. Also, your model does not even need a FOR loop and you don't need to wire the indices of "index array" if you want them in order starting with zero.
Here's how the model could look like:
03-11-2009 05:30 PM
03-11-2009 05:36 PM
About the for loop - I tried it your way and saw it work. But the template they suggested to work from has the for loop. I don't know why. Using a for loop is an easy way to create arrays to feed the curve fitting vi at X and Y, like I did with the bit pasted on the left.
It makes more sense, if the model doesn't have the for loop. I wonder if I gave the curve fitter 6 points or 36? Must look.
Hey, thanks for pointing out that index array doesn't need indices to go 1, 2, 3.... I have to confess to converting arrays to clusters and using unbundle to get the opposite of Build Array, when nobody is looking. You just saved me a lot of foolish work!
03-11-2009 06:02 PM - edited 03-11-2009 06:03 PM
cebailey wrote:Hey, thanks for pointing out that index array doesn't need indices to go 1, 2, 3....
Careful now! Unwired it will go 0,1,2,3 .... The first element is #0. (This is not e.g. matlab where the first element is #1)
If you want to go 1,2,3,4 for example, all you need is wiret a "1" to the first index and the rest will increment. Basically any unwired index will be one higher than the terminal above it.
For example, the following code would give you elements 2, 3, 4, 5, 10, 11, 12