While there might not be explicit documentation on the expected syntax for the signal callback, here's a way to add a Signal Table and attach callbacks to signals which worked for me:
1. A Signal Table is added to the app layout using the App Designer.
2. In the startupFcn, the following code was added to stream the 'reference' and 'cartposition' signals to the Signal Table:
app.SignalTable.Signals = struct( ...
'BlockPath', {'reference', 'cartposition'}, ...
'PortIndex', {-1, -1}, ...
'Decimation', {1, 1}, ...
'ArrayIndex', {[], []}, ...
'BusElement', {'', ''}, ...
'Callback', {@app.refSigCallback, []});
Here, the refSigCallback function is attached to the 'reference' signal.
3. The callback function, refSigCallback, modifies the signal value by rounding it to two decimal places:
function refValue = refSigCallback(app, refValue)
refValue = round(refValue,2);
Note that the callback receives the current signal value as the only argument and outputs the modified signal value. The result depicted below confirms that the refSigCallback signal is rounded off as expected.
For connecting callbacks directly to instruments, refer to the documentation pages: