From: CyberFrog on 21 Jun 2010 12:34 Doug Schwarz <see(a)sig.for.address.edu> wrote in message <fhMTn.83673$HG1.64233(a)newsfe21.iad>... > CyberFrog wrote: > > Hi all, > > > > I have a simple fprintf code as follows: > > > > fido = fopen(myfile, 'a'); > > fprintf(fido,['Name: ',mystring,'\n']); > > > > where mystring is: 'dogs' and this seems t print ok. However if > > mystring is longer i.e. I have tried to use a pathname instead, > > > > mystring='C:/all/this/way/to/get/home/sweet/home' > > > > I get a warning: > > > > Warning: Invalid escape sequence appears in format string. See help > > sprintf for valid escape sequences. > > Does anyone know what this means? > > If you really used forward slashes then this should be fine, but if you > actually used backslashes (like are normally used on Windows) then you > have constructed a format string containing things like '\w' and that is > an invalid escape sequence. Obviously, your example is not what you > really used so I can't be more specific. The problem is not the length > of mystring. > > The way to avoid the problem is > > fprintf(fido,'Name: %s\n',mystring); > > -- > Doug Schwarz > dmschwarz&ieee,org > Make obvious changes to get real email address. Many thanks all, in fact the first reply got my mystring to pass through successfully! Thanks again for your invaluable input |