Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: What's the difference of \\ and \ when used in sprintf?
Replies: 2   Last Post: Jun 30, 2013 11:36 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dpb

Posts: 8,212
Registered: 6/7/07
Re: What's the difference of \\ and \ when used in sprintf?
Posted: Jun 30, 2013 10:01 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 6/30/2013 8:03 PM, Jixin wrote:
...

> I tried to generate a file name by sprintf as:
>
> filename = sprintf('D:\...\%03d', 1);
>
> and it doesn't work.

...
> filename = sprintf('D:\\...\\%03d',1);
>
> and it works.
> So what's happening here?

...

doc sprintf

page down in the format spec section on 'Escape characters' and all will
become clear...

--





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.