Next: , Previous: , Up: Directory Index   [Contents][Index]


2.12 general

Function File: cputic ( name )
Function File: t = cputic ( name )

Sets or retrieves the value of a named CPU time counter.

Examples

cputic("__test");
Function File: cputoc ( name ) ;

Prints the elapsed CPU time since a named CPU time counter was set.

Examples

cputic("__test");
cputoc("__test");
Function File: DebugLevel level
Function File: DebugLevel ( level )
Function File: level = DebugLevel ( )

Sets and/or returns the OctApps debug level level.

Examples

assert(DebugLevel() == 0);
DebugLevel 1;
assert(DebugLevel() == 1);
DebugLevel(2);
assert(DebugLevel() == 2);
Function File: DebugPrintf ( level, args… )

If DebugLevel() >= level, then print args… using fprintf() to stdout.

Examples

DebugLevel(1);
DebugPrintf(0, "Hi there\n");
Function File: name = funcName ( )

Returns the name of the currently executing function.

Function File: [ val ] = getoptfield ( def, S, … )

Return getfield (S, …), if it exists, otherwise return def.

Examples

assert(getoptfield(1, []), 1)
assert(getoptfield([], struct("a", 1), "a"), 1)
assert(getoptfield([], struct("a", 1), "b"), [])
Function File: f = isInteractive ( )

Returns whether the calling Octave script is being run from an interactive session, as opposed to from the command line. If calling function is not a script, return empty.

Examples

assert(isInteractive());
Function File: [ x1, x2, … ] = native ( x1, x2, … )

Converts its arguments from foreign objects (e.g. SWIG-wrapped objects) to native Octave objects, if possible. Native objects are passed though.

Examples

assert(isscalar(native(rand())))
Function File: octapps_config_info

Backwards compatible replacement for ’octave_config_info()’ function, which in newer octave versions has been renamed to ’__octave_config_info__()’ see https://octave.org/doc/v6.4.0/Obsolete-Functions.html#Obsolete-Functions

Examples

octapps_config_info();
Function File: prog = printProgress ( … )

Prints a progress message at decreasing intervals, displaying the number of tasks completed, CPU usage, time elasped/remaining

Example

prog = [];
for i = 1:5000
  for j = 1:5
    doSomeTask(i, j, ...);
    prog = printProgress(prog, "inner loop", [i, j], [5000, 5]);
  endfor
  prog = printProgress(prog, [i, j], [5000, 5]);
endfor
Function File: runCode ( params, code, [ verbose = false ] )
Function File: output = runCode ( … )

Generic code-running driver: run code, passing any command-line options in the struct params, which are passed to code in —name=val format. Use params.LAL_DEBUG_LEVEL to set the LAL debug level. If verbose is true, print command before running it.

Examples

runCode(struct("c", 'echo "This is a test of runCode()"'), "/bin/sh");
Function File: [ s ] = sortStructFields ( s )

Return the struct S with its fields sorted alphabetically.

Examples

S1 = struct('name', {'Peter', 'Hannah', 'Robert'}, 'age', {23, 16, 3});
S2 = sortStructFields(S1);
assert(all(strcmp({S1.name}, {S2.name})));
assert(all([S1.age] == [S2.age]));
Function File: unmanglePATH

Aaargh Octave! At startup it prepends PATH with directories containing Octave executables - which if it’s installed in /usr/bin include /usr/bin. This will clobber any existing paths in PATH that were meant to override /usr/bin, such as e.g. custom installation of LALSuite!

This script undoes the damage.

Examples

unmanglePATH();

Next: , Previous: , Up: Directory Index   [Contents][Index]