If you want to trigger a raw notification from a
MATLAB
script, you can use the following function:
notify17.m
functionnotify17(rawAPIKey, title, content)%NOTIFY17 Triggers a notification using Notify17%% Parameters:% * rawAPIKey (required) - https://dash.notify17.net/#/rawAPIKeys% * title (required) - Notification title% * content (optional) - Notification contentifnargin<=2content='';endurl=strcat('https://hook.notify17.net/api/raw/',rawAPIKey);options=weboptions('RequestMethod','post','ArrayFormat','json','ContentType','text');data=webread(url,'title',title,'content',content,options);disp(['Notify17 response: ',data]);end
Usage (e.g. when you want to know if a simulation completes successfully or not):
testN17.m
n17RawAPIKey='RAW_API_KEY';try% Code which may trigger an error% e.g. missing argumentsplusnotify17(n17RawAPIKey,'Simulation completed',...'The simulation has completed successfully');catchexnotify17(n17RawAPIKey,'Simulation error',...
"Anerrorhasbeenencountered:" +newline+...getReport(ex,'extended','hyperlinks','off'));end
Output:
Simulation error
---
An error has been encountered:
Error using +
Not enough input arguments.
Error in testN17 (line 6)
plus