octave-maintainers
[Top][All Lists]
Advanced

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

Re: Matlab test


From: Ben Abbott
Subject: Re: Matlab test
Date: Fri, 17 May 2013 08:34:06 +0800

On May 17, 2013, at 7:02 AM, Michael Goffioul wrote:

> Hi,
> 
> Can I ask anybody to make a test for me under Matlab. I'm trying to determine 
> when Matlab actually parses files that are contained in a package. The only 
> thing I can think of is to put a parse error into one of the files.
> 
> So the test would be to have a package, not initially in your path, and a 
> file (e.g. a function file) in that package, which contains a parse error. 
> Then use "addpath" to make the package visible, that is adding the parent of 
> the package directory to the path.
> 
> So let's say you have the following: a/+pack/invalid_fun.m (invalid_fun.m has 
> a parse error). Then try the following commands (if any of the command 
> produces an error, don't bother going further):
> 
> addpath a
> p = meta.package.fromName('pack')
> fcn = p.Functions{1}
> fcn()
> 
> Michael.

I used a trivial function

function a = invalid_fun (a)
  a = a .+ 1;
end

Then ...

addpath ('~/Documents/MATLAB/a')
matlab>p = meta.package.fromName('pack')

p = 

  package with properties:

                 Name: 'pack'
            ClassList: [0x1 meta.class]
         FunctionList: [1x1 meta.method]
          PackageList: [0x1 meta.package]
    ContainingPackage: []

matlab>fcn = p.Functions{1}

fcn = 

  method with properties:

                   Name: 'invalid_fun'
            Description: ''
    DetailedDescription: ''
                 Access: 'public'
                 Static: 0
               Abstract: 0
                 Sealed: 0
                 Hidden: 0
             InputNames: {'rhs1'}
            OutputNames: {'lhs1'}
          DefiningClass: []

matlab>fcn()

ans = 

  method with properties:

                   Name: 'invalid_fun'
            Description: ''
    DetailedDescription: ''
                 Access: 'public'
                 Static: 0
               Abstract: 0
                 Sealed: 0
                 Hidden: 0
             InputNames: {'rhs1'}
            OutputNames: {'lhs1'}
          DefiningClass: []

And I get no error.  Have I done something wrong?  I'm not familiar with the 
meta.packages.  How may I actually call the function?

Ben




reply via email to

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