|
From: | Michael Goffioul |
Subject: | Re: Matlab test |
Date: | Thu, 16 May 2013 21:09:29 -0400 |
I used a trivial functionOn 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.
function a = invalid_fun (a)
a = a .+ 1;
end
Then ...
addpath ('~/Documents/MATLAB/a')
matlab>p = meta.package.fromName('pack')
p =
package with properties:
matlab>fcn = p.Functions{1}
Name: 'pack'
ClassList: [0x1 meta.class]
FunctionList: [1x1 meta.method]
PackageList: [0x1 meta.package]
ContainingPackage: []
fcn =
method with properties:
Name: 'invalid_fun'
Description: ''matlab>fcn()
DetailedDescription: ''
Access: 'public'
Static: 0
Abstract: 0
Sealed: 0
Hidden: 0
InputNames: {'rhs1'}
OutputNames: {'lhs1'}
DefiningClass: []
ans =
method with properties:
Name: 'invalid_fun'
Description: ''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?
DetailedDescription: ''
Access: 'public'
Static: 0
Abstract: 0
Sealed: 0
Hidden: 0
InputNames: {'rhs1'}
OutputNames: {'lhs1'}
DefiningClass: []
[Prev in Thread] | Current Thread | [Next in Thread] |