From: dpb on
Ali Haider wrote:
> I have written a function that calculates some variable "t":
>
> function t=t_from_phi(phi, far)
> i = 0;
> t = exp((phi - 2.81661)/3.648659);
> error = phi - phi(t, far);
....
> end
>
> the above function uses one more function "phi(t,far)" i.e.
>
> function phig = phi(t,far)
> phi_prod = 0.921799*log(abs(t)) + ...
....
> end
>
....
> when I tries to run the code it gives the error:
> ??? Subscript indices must either be real positive integers or
> logicals.
>
> Error in ==> t_from_phi at 5
> error = phi - phi(t, far);
>
....

You have tried to use phi as both a variable and a function -- Fortran
can resolve that difference, Matlab can't.

Rename one or the other.

--