Utils

compile(output, source, include, opts)[source]

Compile a C++ MEX file for the current platform with the selected compiler

USAGE:

compile (output, source, include, opts)

INPUTS:
  • output – output location (base name) for the compiled mex file

  • source – filename or cell array of filenames of the C++ source files

OPTIONAL INPUTS:
  • include – directory or cell array of directories to search for #include files

  • opts – structure of compiler options with fields:

    • .std - C++ language standard passed to the compiler (e.g. c++17)

    • .debug - logical, true to compile with debug symbols (-g)

    • .fmath - logical, true to enable fast-math optimization flags

getField(o, field, default)[source]

Return the value of a struct field, or a default when the field is absent

USAGE:

x = getField (o, field, default)

INPUTS:
  • o – structure to query

  • field – char, name of the field to read

  • default – value returned when o has no field named field

OUTPUTS:

x – the value of o.(field) if present, otherwise default

isarm()[source]

Return true when running on an Apple silicon (ARM) processor

USAGE:

r = isarm()

OUTPUTS:

r – logical, true on an Apple ARM CPU, false otherwise

loadModular(name)[source]

Add a sibling module folder to the path and run its config<name> script

USAGE:

loadModular (name)

INPUTS:

name – char, name of the module to load (its folder is a sibling of this file)

setField(o, value)[source]

Copy matching fields from a source struct/object into a template struct

USAGE:

o = setField (o, value)

INPUTS:
  • o – template structure whose field names determine what is copied

  • value – structure or object supplying the new field values

OUTPUTS:

oo with each field also present in value overwritten from value