Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.straub-nv.de!feeder.eternal-september.org!eternal-september.org!not-for-mail
From: dpb <none@non.net>
Newsgroups: comp.soft-sys.matlab
Subject: Re: String Operations
Date: Sun, 08 Nov 2009 17:52:31 -0600
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <hd7lk7$m58$1@news.eternal-september.org>
References: <hd466l$scb$1@fred.mathworks.com> <hd47i0$jbq$1@news.eternal-september.org> <hd486g$14a$1@fred.mathworks.com> <hd48tv$v8q$1@news.eternal-september.org> <hd7kjo$id5$1@fred.mathworks.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.eternal-september.org U2FsdGVkX19qLoGHBintRdqbkqbYTjHVwAZxOf36leg/v5xX/GOQ7IuA4XQpB1gFOa1QD7bKlt+Wf8n0+zrFTq2Lnj4Ys6U8rGXJDxlJfRWRvK/HtXETJHWihrTHHXPZ8PNuuZT6VCA=
X-Complaints-To: abuse@eternal-september.org
NNTP-Posting-Date: Sun, 8 Nov 2009 23:52:39 +0000 (UTC)
In-Reply-To: <hd7kjo$id5$1@fred.mathworks.com>
X-Auth-Sender: U2FsdGVkX18LYpNSoMf7nAOXvKeISbINSPHNRLHvFIU=
Cancel-Lock: sha1:yVXui51U5ju3e83AIU3eqSuEFEw=
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
Xref: news.mathworks.com comp.soft-sys.matlab:583438


Steven Lord wrote:
> "dpb" <none@non.net> wrote in message 
...
>> There's bound to be a way to get the stupid C format string to allow you 
>> to enter a literal percent character as a character-matching character, 
...

> I would try two percent characters.
> 
>>> fprintf('%%\n')
> %

This was for sscanf() input, not output, and I was pretty sure I had 
tried it but must've had a typo I didn't recognize as

 >> s='-94%22%'
s =
-94%22%
 >> sscanf(s,'%d%%')
ans =
    -94
     22
 >>

does work (at least when one types it in correctly :) ).

I'm not sure what I did wrong now; I thought initially that would/should 
work correctly, too, but as noted somehow I futzed it, apparently.

--