What Is UDF

User-defined functions, or UDFs, are AUX functions stored in .aux files. In auxlab2, a UDF is typically loaded from disk, registered with the engine, and then called by its file name without the .aux extension.

Basic Form

A simple UDF file can start with a function definition like this:

function y = myudf(x)
y = x.sqrt

If this is saved as myudf.aux and the file is loaded, you can call it as:

out = myudf([1 4 9 16])

Multiple Outputs

A UDF can return more than one output.

function [sumv, diffv] = pair_ops(a, b)
sumv = a + b
diffv = a - b

Usage:

[s, d] = pair_ops(10, 3)

Member Functions

The current codebase also supports member-style UDF definitions.

member function out = myfunc(arg)
out = name ++ sprintf("%d", id)

This form is useful when the function is meant to operate in a member-call context.

Working With UDF Files In auxlab2

In the current auxlab2 application:

Under the hood, the app loads the file path, defines the UDF, and then registers it with the AUX engine.

Notes

Current source basis: