What is a grandfathered syntax, as in the MATLAB "radon" function?

934 views Asked by At

I found a function with a "secret" input, which someone can perhaps explain? What could be the reason? Are there many cases of such a thing?

In the documented syntax of radon function, there are two ways to call the function - the conventional one with inputs of I and THETA, (for image and desired projection angles), and also an option to omit THETA, and give only I as input.

But in the comments inside the radon.m file, there is another part at the end, that is described as "grandfathered syntax". This allows three inputs, including also the number of desired projections. And, it really works!

So, why isn't this documented? Has it been available in the past, and then deleted/changed (as "grandfathered syntax" would suggest)? So why does this still work?

And, another question about radon.m:

The main part of the function is computed by calling another function, called radonc. What is it? Where does it reside? I can't find it, or any mention of it anywhere.

1

There are 1 answers

4
Sam Roberts On BEST ANSWER

"Grandfathered" syntax typically means that it's a syntax that

  1. used to be documented and supported
  2. still needs to be kind of supported because some customers still rely on it, and MathWorks wouldn't want their code to break
  3. is no longer recommended, and is therefore undocumented so that new users will not start to rely on it
  4. may get completely removed in future.

radonc is in \toolbox\images\images\private. The which command won't find it because it's in that private directory, and so can only be called by functions in the directory immediately above (which includes radon itself). The file is radonc.mexw64 (possibly a different mex file extension if you're on a different platform to me), indicating that it's implemented as compiled C code rather than MATLAB code (and in case this is why you're asking, it means you can't see the source).

Edit: Note that in the same directory there is also a file radonc.m. This file doesn't do anything, as the mex file has higher precedence; it is there to provide help for the radonc function. If you type help radonc, you'll see that it shows the help text provided by the comments of radonc.m.