Home »
Public Forums »
archive »
Return statement must have 1 value?
Return statement must have 1 value? [message #10106] |
Tue, 21 October 1997 00:00 |
D.Kennedy
Messages: 26 Registered: January 1997
|
Junior Member |
|
|
In the course of some quick and dirty data reduction I've hit a weird
bug with the RETURN keyword. Its really confusing me (as well as stopping
me from progressing with the work!). Help appreciated.
It says:
return answer
^
% Return statement in functions must have 1 value.
Here's some code, no comments on the algorithm please, I know there must
be better ways of doing this (calculating the FWHM of a gaussian); the
input is a 1-D array.
function calc_fwhm2, gaussian
x1 = 0 & x2 = 0
maximum = max(gaussian)
half_maximum = max(gaussian)/2
midpoint = where(gaussian EQ maximum)
i=0
while gaussian(i) LT half_maximum DO i=i+1
x1=i
i=midpoint
while gaussian(i) GT half_maximum DO i=i+1
x2=i
answer = x2 - x1
return answer
end
Replies by email appreciated; no excuses, I'm just lazy about checking
groups.
--
David Kennedy, Dept. of Pure & Applied Physics, Queen's University of Belfast
Email: D.Kennedy@Queens-Belfast.ac.uk | URL: http://star.pst.qub.ac.uk/~dcjk/
My .sig was so clever that it actually escaped!
|
|
|
Current Time: Fri Oct 10 10:22:18 PDT 2025
Total time taken to generate the page: 0.88056 seconds