Code covered by the BSD License  

Highlights from
physunits module from FORTRAN

4.5 | 2 ratings Rate this file 13 Downloads (last 30 days) File Size: 32 KB File ID: #13018 Version: 1.0

physunits module from FORTRAN



15 Nov 2006 (Updated )

A toolbox that handles dimensioned variables

| Watch this File

File Information

The physunits toolbox is an attempt to confer dimensional "awareness" to the MATLAB environment. The motivation for this, as well as a suggested way to go about it, are explained in
% Petty, G.W., 2001: Automated computation and consistency checking of
physical dimensions and units in scientific programs. Software -
Practice and Experience (Volume 31, Issue 11, 19 June 2001)

The author of the same has also made available for download a FORTRAN90 module that implements this ides in the FORTRAN language. The module and paper can be downloaded from

The physunits toolbox is based on the above module, and expands it, while trying to adhere consistently to MATLAB standards and practices.

The zip file contains:

@preal (directory) -
In MATLAB, classes are defined by a directory of the class name preceded by a @ sign. The @preal directory contains the preal class definition and methods. To use the preal class, the directory IMMEDIATELY ABOVE @preal should be added to the MATLAB path.

setUnits.m -
MATLAB .m file with predefined units and constants. See documentation for usage.

info.xml - Pointer to the html documentation file. Used by the MATLAB
help browser.

html (directory) -
Containing the html help and documentation files.

physunits.m - a function for switching the physunits on or off.

iceball.m - a short sample program that demonstrates the preal class.

MATLAB release MATLAB 7 (R14)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
13 Mar 2012 Patrik Eschle

Very nicely done, thank you! I always wondered why Matlab does bring this feature natively.

25 Apr 2007 Riccardo Meldolesi

this toolbox seems pretty good. The list of overloaded matlab functions is pretty exhaustive.

A wish could be to have the possibility to type directly the unit name rather than access a subfield of the @preal class, for example:

aVariable = 12 * m

instead of:

aVariable = 12 * si.metre

I could suggest a couple ow ways to do it in a OO way.

A small improvement to an alreadyvery good piece of code.

28 Dec 2006

Moved to category Utilities:Development environment

15 Nov 2007

Added functions:

Contact us