Problem with single quotes

Andreas Yankopolus andreas at yank.to
Thu Oct 2 10:37:31 CDT 2008


John,

> You should not need to use fprintf (1, fmt, args, ...).  You can  
> just write fprintf (fmt, args, ...).  This works because if the  
> first argument to fprintf is a character string, it is used as the  
> format and the default output stream is the standard output (stdout,  
> or stream number 1).

Thanks. That will make for more readable code.

> | >  2) The escape code for ' inside a single quoted string is ''.
> | >
> | > So, the following should work:
> | >  fprintf ('''')
> |
> | I did not know that. That statement prints a double quote in Octave.
>
> No, it should print a single ' character, same as Matlab.

I can only report what I see. I've tried it on Octave 3.0.2 (OS X) and  
Octave 3.0.0 (Ubuntu Hardy). Both give me a double quote.

> | I'll give it a shot in Matlab and see what happens.

A colleague just tried it on Matlab and got a double quote as well.

Cheers,

Andreas



More information about the Help-octave mailing list