From: - on 12 Jul 2010 07:52 "Wayne King" <wmkingty(a)gmail.com> wrote in message <hqn25r$lmg$1(a)fred.mathworks.com>... > "Amey Kulkarni" <am16ey(a)gmail.com> wrote in message <hqmo13$k0k$1(a)fred.mathworks.com>... > > i hav written a program in matlab...i hav made the exe file for the same...i want to put the output of the program on the web site... i am using php passthru function for that.... but the output of the program comes in one line only... i want to put a newline in matlab program... can anyone help in this matter?? > > Hi Amey, Depending on how your program is structured, is it as simple as including a > > fprintf() or sprintf() with the escape character '\n' ? > > fprintf('%s\n','hello'), fprintf('%s\n','and goodbye') > > or just > > fprintf('\n'); > > for a new line. Does that work? > fprintf('/n'); does NOT escape the /n who was dumb enught to invent that escape chars are sometimes escaped and sometimes not? > Wayne
From: Walter Roberson on 12 Jul 2010 08:56 - wrote: > fprintf('/n'); does NOT escape the /n forward-slash in a format is _always_ just a literal forward slash. backward-slash in a format is the signal for an escape sequence. fprintf('\n') > fprinft(1,FORMAT) prints into the comand window. Not exactly: fprintf() to fid 1 prints to standard output, which is the command window unless you have redirected output on the invocation of matlab. But the destination of fprintf(1,FORMAT) does not appear to be relevant to your question, unless perhaps you missed that the other respondents used backwardslash-n ('\n') rather than forwardslash-n ('/n') > who was dumb enught to invent that escape chars are sometimes escaped > and sometimes not? Suppose that escape characters were always escaped: then how would you output a literal backwardslash followed by an n ? If you use any particular character to indicate that the next character is special, you need a way to indicate that you want to print the indicator character itself.
|
Pages: 1 Prev: Naming a variable with userinput Next: how to create a newline in matlab? |