send_message¶
send_message writes a text in the log of AnyWave. The messages appear in the log window connected to the plugin:
it is the best way to follow what a plugin does. send_text is another name for the same command.
function main(varargin)
anywave('init', varargin);
anywave('send_message', 'Hello AnyWave');
anywave('send_message', sprintf('%d channels, %.1f s of data', 3, 10));
end
- The message must be a char array (single quotes). A double quoted
"text"is a MATLAB string and is refused: the error issend_message: argument must be a string. - The message may contain accents.
A small wrapper¶
To make the calls shorter, write a function in your plugin:
function log_message(varargin)
% log_message('value is %d', 12)
anywave('send_message', sprintf(varargin{:}));
end
Report errors¶
try
out = anywave('get_data', cfg);
catch err
anywave('send_message', ['get_data failed: ' err.message]);
rethrow(err);
end