Lack of clarity in Matlab

An odd bug (or lack of feature?) I found with Matlab results in a error messages that are largely unhelpful to track down why your code isn’t running. I had this happen a few months ago and solved it but then completely forgot again when it happened again today, so hope this helps.

I was running a program needing to use resample.m part of Mathwork’s own code. Running resample.m with proper inputs got back the message:

>Undefined function 'resample' for input arguments of type 'double'.

That’s strange. If you type exist(‘resample’) it comes saying it does in fact exist. If you type edit resample.m you get a file to come up…what’s going on?! Doing a file search also reveals that matlab toolboxes have at least 6 different copies of a file called resample.m (another confusion, but that’s another story). This seems really strange! Another useful function is which, to track down the path matlab is using when invoking a function. And here we get:

> which resample
C:\Program Files\MATLAB\R2015a\toolbox\signal\signal\resample.m % Has no license

I’m on a network license of matlab sharing with coworkers! So there you have it, we exceeded our number of seats. Totally baffling though when you first try to diagnose. Mathworks really should have a way to give a nice verbose error about when you try to use files that do indeed exist but have no valid license so can’t be executed.

See Also: