1

I was going through a .cpp file which is the source for a MATLAB S-Function and I noticed that to print on the "console" the programmer wrote:

SFUNPRINTF("Text I want to print on the console");

While I would have done:

printf("Text I want to print on the console");

Could you explain me the difference ? Is it just something particular of this code or is it some kind of instruction that I am not able to find online?

thanks for your help.

desmond13
  • 2,913
  • 3
  • 29
  • 46
  • 2
    I suspect if you trace down the definition of `SFUNPRINTF` it would be rather informative. – WhozCraig Nov 21 '14 at 12:03
  • I tried but it is not listed in the .cpp file. Probably somewhere else? – desmond13 Nov 21 '14 at 12:13
  • I have a hunch that it works like `printf`, but prints to something other than standard-out. Why don't you have a peek at the documentation? – molbdnilo Nov 21 '14 at 12:21
  • 3
    if its inline with [`MEXPRINTF`](http://uk.mathworks.com/help/matlab/apiref/mexprintf.html), which I would take to be the equivalent (for mex instead of s function). The purpose is likely given by this snippet from the mex documentation: "This routine prints a string on the screen... snip... . It provides a callback to the standard C printf routine already linked inside MATLAB® software, which avoids linking the entire stdio library into your MEX-file." – RTL Nov 21 '14 at 13:35

0 Answers0