Code covered by the BSD License  

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
physunits module from FORTRAN

  • ispure(d)ISPURE Overloaded PREAL/ISPURE function to run when physunits is disabled.
  • physunits(flagString)PHYSUNITS Enable/Disable the physunits toolkit.
  • setFUnitsSETFUNITS Create an "fake units" structure.
  • setUnitsSETUNITS Create an interface structure to the PREAL data type.
  • preal.mPREAL Constructor of the preal class.
  • iceball.mExcersize 1 - Calculate the equilibrium surface temperature of an icy
  • View all files
4.5
4.5 | 2 ratings Rate this file 13 Downloads (last 30 days) File Size: 40.9 KB File ID: #13018 Version: 1.2

physunits module from FORTRAN

by

 

15 Nov 2006 (Updated )

A toolbox that handles dimensioned variables

| Watch this File

File Information
Description

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
http://rain.aos.wisc.edu/~gpetty/physunits.html
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)
MATLAB Search Path
/
/physunits
/physunits/html
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
26 Apr 2016 Mark Mikofski

Mark Mikofski (view profile)

Also try quantities
http://www.mathworks.com/matlabcentral/fileexchange/48988-mikofski-quantities

Inspired by python pint

Comment only
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.

Updates
28 Dec 2006

Moved to category Utilities:Development environment

15 Nov 2007

Added functions:
plot
loglog
semilogy
semilogx

31 Jan 2016 1.2

Added setFUnits.m to create a "fake units" structure with only type double for deployment to users who do not wish to install the toolbox. Deployment usually involves a single line (single character really) change to code.
Update documentation.

Contact us