Since Matlab is interpreted, typically spend a lot of time at the beginning of the function enforcing the function signature. For example
if nargin ~= 2; error('must provide two input args a and b'); end
if a < 0||a ~=floor(a); error('input arg1 must be positive non-zero integer'); end
if ~isa(b,'cell') ...
Is it better to use Matlab's assert() for this instead? If not, when is the appropriate time to use assert() in Matlab?
There is a great discussion on using assert in production code here but I am not certain this applies to interpreted code. Likewise, another good discussion here and I agree with @Dan Dyer regarding assert to express belief about the current state. However, looking at a similar discussion for Python here folks say, only use assert for situations that should never happen (like exceptions for exceptional cases) which is a little contradictory w.r.t. the previous references.
Maybe this is more a question about the role assert plays in interpreted languages and less about Matlab.