Skip to content

Packages

jonesg5 edited this page Sep 15, 2014 · 4 revisions

An Introduction to Packages in MATLAB and Their Use in This Toolbox

Packages are any folders with a + (plus) character preceding the name. Packages serve as a way to organize functions and prevent duplicate function names. For details on a package's contents you can use help packageName from the MATLAB command line where packageName is the name of the folder without the + character, ex. help daysimeter12.

There are two methods to access functions or classes within a package. The first method is by using the package name followed by a period followed by the function name to call the function.

Example using a package function with dot notation:

[absTime,relTime,epoch,light,activity,masks] = ...
daysimeter12.convertcdf(filePath);

The second method is to use the import function to either import an entire package or select functions within a package.

Example importing an entire package:

import daysimeter12.*
[absTime,relTime,epoch,light,activity,masks] = convertcdf(filePath);

Example importing select functions from a package:

import daysimeter12.convertcdf daysimeter12.readcdf
[absTime,relTime,epoch,light,activity,masks] = convertcdf(filePath);
Data = readcdf(filePath);


See also

Clone this wiki locally