You cannot write an idiot-proof software, but you can try your best to prevent it from crashing in an unfriendly way.
Writing code that works well as long as you are careful only to provide the correct input and output is one thing. Writing code that is robust and can deal with the wrong number and type of input and output parameters something different.
Clearly, having the user in mind who is not an expert in programming nor in Matlabâ„¢ debugging, programming every function that is part of the toolbox as robust and save as possible is very important.
For the time being, just a list of bullet points:
try
-catch
statements.error()
function, as long as you are not sure that the exception this causes get's properly dealt with. Otherwise, you may break scripts/functions users have written using toolbox functions.