OK!
The main problem is the fact that you are calling the "general Lorentzian" function, which expects 5 parameters and extra data, yet your initial estimates only contain 4 elements and you don't provide the extra data. At the moment you should call the plain "Lorentzian". It works well!
The more general problem is the fact that you do many things way too complicated. Virtually all of your loops have near equivalent built-in functions.
The code is completely fragmented and parts linked via local variables, while sequences are then used to re-establish execution order. You should also get rid of all stacked sequences and all these extra controls that have the sole purpose of providing local variables.
(You seem to be coming from text based programming languages, so you should loose that kind of sequential thinking!
The wire is the variable! See also
this old post)
Once everything is wired together, data dependency will properly determine execution order and the sequences are unnecessary.
I cleaned up the code a bit, but please verify correct operation (you might need to tweak some edge effects here or there, nothing a +1 or -1 cannot fix, who knows? I literally translated some code segments because I wasn't sure what you were really trying to do). One glaring error was the fact that you indexed into the array subset as if you are still operating on the full array. I left a diagram comment. I am sure many more simplifications are possible.
I reduced the entire project to 4 relatively simple VIs. The main VI also shows the best fit function, overlayed over the data. See for yourself.
Let me know if you have any questions. Good luck!
(Of course you should make the main program into a real UI, with buttons to read a new data file, automatic refitting if the initial estimates or cursor position changes, error handling, etc. Just add a while loop and an event structure, the rest should almost fall into place. :))
Message Edited by altenbach on 08-11-2007 12:21 PM