help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting Matlab geophysics code running in Octave


From: Juan Pablo Carbajal
Subject: Re: Getting Matlab geophysics code running in Octave
Date: Sun, 4 Aug 2013 22:54:35 +0200

On Sun, Aug 4, 2013 at 10:33 PM, Lester Anderson <address@hidden> wrote:
> Hi Juan,
>
> I moved a copy of defval.m into the same folder as the two main files
> (coheref2.m and forsyth.m), I fixed the references to values that were not
> declared in forsyth.m, and it got a little farther along -
>
> octave:9> coheref2
> ans = [](0x0)  ---------> these look odd!
> ans = [](0x0)
> ans = [](0x0)
> ans = [](0x0)
> ans = [](0x0)
> ans = [](0x0)
> error: 'xver' undefined near line 63 column 6
> error: called from:
> error:   c:\matlab\functions\simmons_matlab\forsyth.m at line 63, column 3
> ------->        if xver==1
> error:   c:\matlab\functions\simmons_matlab\coheref2.m at line 33, column 2
> ------->   C=forsyth(Te,lambda,f2,r);
> octave:9>
>
> Lines 62-65 forsyth.m
>
>   xver=0
>   if xver==1
>     disp(sprintf('E= %5.3g; v= %5.3f',E,v))
>   end
>
> The working directory now has all three files in place - I cannot see what
> else could be missing. I have attached the updated forsyth.m
> Changes made :   defval('g',9.81);
>   G=6.67e-11;
>
> It is looking more like the issue is in forsyth.m ?
>
> All rather confusing
>
> Lester
>
>
> On 4 August 2013 20:42, Juan Pablo Carbajal <address@hidden> wrote:
>>
>> On Sun, Aug 4, 2013 at 9:42 PM, Juan Pablo Carbajal
>> <address@hidden> wrote:
>> > On Sun, Aug 4, 2013 at 9:40 PM, Lester Anderson <address@hidden>
>> > wrote:
>> >> Hi Ben,
>> >>
>> >> Yes it was a mistype. Either way I cannot get the code to work - so I
>> >> gues I
>> >> will just have to strip it back and code it in Fortran.
>> >>
>> >> Thanks anyway for the help
>> >>
>> >> Lester
>> >>
>> >>
>> >> On 4 August 2013 20:34, Ben Abbott <address@hidden> wrote:
>> >>>
>> >>> On Aug 4, 2013, at 12:29 PM, Lester Anderson wrote:
>> >>>
>> >>> > Defval is clearly a Matlab intrinsic function.
>> >>>
>> >>> I assume this is a mistype?
>> >>>
>> >>> defval is definitely not an intrinsic function of Matlab.  It is
>> >>> certainly
>> >>> a Matlab function, but is not "intrinsic" to Matlab (i.e. is not part
>> >>> of
>> >>> Matlab, not Mathworks copyright, etc).
>> >>>
>> >>> Ben
>> >>>
>> >>
>> >>
>> >> _______________________________________________
>> >> Help-octave mailing list
>> >> address@hidden
>> >> https://mailman.cae.wisc.edu/listinfo/help-octave
>> >>
>> >
>> > Lester, it seem defval is not in your path. Can you run
>> >> which defval
>> > in the Octave prompt?
>>
>> and can you locate defval? In which folder it is placed?
>
>

that there is an error on the lines
xver=0
if xver == 1

is indeed confusing and cannot happen unless something is very wrong.
Now the function you sent has defval('xver',0) and that can indeed
cause an error. What version of forsyth were you using?

You can add the command

keyboard

in line 61 of forsyth. It will give you the debugger prompt where you
can test the variables (using who, whos, etc).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]