[proFit-list] Dynamically Adding Variables

pro Fit Support profit at quansoft.com
Mon Jun 1 22:37:34 CDT 2009


Andrew

Yes, you can do that. Basically, you call SetFunctionProperties for  
nrParameters in Check. Here is an example, which basically sets the  
number of parameters to the value you enter in a[1].


function MyPoly;

  var i;

function Check;
begin
	if pNumber = 1 then				// if a[1] has changed
		if (a[1] < 1) or (a[1] > 100) then
			Check := bad
		else
		begin
			SetFunctionProperties(function '', nrParams a[1]+1);
			Check := update;			// redraw the parameter window
		end;
end;

begin
	y := 0;
	for i := 1 to a[1] do
		y := x*y + a[i+1];
end;
		
	
You can also set the names of the parameters using  
SetParameterProperties,

Good luck

Kurt



On 1. Jun 2009, at 18:21, Andrew Cameron Beveridge wrote:

> I would like to make a function where I can dynamically add variables;
> like the "polynomial" and "peaks" function. In those functions you can
> specify the the number of peaks or the order of the polynomial.
>
> Is there anyway to write a function that does this. I cannot find it  
> in
> the manual.
>
> Thanks for your help.
>
> Regards,
> Andrew
>
>
> Andrew C Beveridge
> MS M888
> Los Alamos National Laboratory
> Los Alamos, NM  87545
>
> _______________________________________________
> proFit-list mailing list
> proFit-list at quantum-soft.com
> http://quantum-soft.com/mailman/listinfo/profit-list_quantum-soft.com




More information about the proFit-list mailing list