For Programmers: Free Programming Magazines  


Home > Archive > Matlab > April 2005 > flushing stream used by mexPrintf?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author flushing stream used by mexPrintf?
Chris Hulbert

2005-04-25, 4:02 pm

Is there anyway to flush the stream used by mexPrintf? I have a MEX
file that's computationally intensive and output is VERY delayed. If
not, maybe TMW could consider adding it to the API, or adding a
flushed version of mexPrintf? It would even be nicer to be able to
get a pointer to the streams for direct I/O.

On another note:
It would be nice to be able to redirect output from command window
to a file like *nix. Also piping would be nice. Haven't seen a way
of doing that either.
Steven Lord

2005-04-25, 8:59 pm


"Chris Hulbert" <cch@REMOVEisl-incTHIS.com> wrote in message
news:ef03eef.-1@webx.raydaftYaTP...

*snip question about mexPrintf, since I'm not sure of the answer*

> On another note:
> It would be nice to be able to redirect output from command window
> to a file like *nix. Also piping would be nice. Haven't seen a way
> of doing that either.


Take a look at the DIARY function or the -logfile startup option listed in
the first chapter of the "Desktop Tools and Development Environment" section
of the manual:

http://www.mathworks.com/access/hel...matlab_env.html

--
Steve Lord
slord@mathworks.com


Chris Hulbert

2005-04-27, 4:03 pm

When i meant redirecting I meant from a matlab prompt.
-logfile will only write to one file and always writes to the file(I
think). I meant a more interactive redirection.

Something like:[color=darkred]

Also, you said you're not sure about the answer to flushing mexPrintf?
That link you sent is just this thread? Not surewhat you were saying

Chris Hulbert

2005-04-27, 4:03 pm

And yes, diary would work, just got to keep track of turing it off/on
etc. I guess the *nix way is just habitual so it feels more natural.
Any thoughts on piping commands?

Steven Lord

2005-04-27, 4:03 pm


"Chris Hulbert" <cchgroupmail@gmail.com> wrote in message
news:1114614247.811706.50600@o13g2000cwo.googlegroups.com...
> When i meant redirecting I meant from a matlab prompt.
> -logfile will only write to one file and always writes to the file(I
> think). I meant a more interactive redirection.
>
> Something like:

All of <, >, &, and | already have meanings in MATLAB (less than, greater
than, logical and, logical or) and so it's unlikely that we'd add new
meanings for them for redirection, to avoid confusion. One thing you can do
is:


t = evalc('myfunc');


Now t is a char array, which you could output to a text file using
FOPEN/FPRINTF/FCLOSE if you wanted, or you could parse t in MATLAB if you
wanted to check the output.
[color=darkred]
> Also, you said you're not sure about the answer to flushing mexPrintf?


That's correct, I don't work with mexPrintf that often so I don't know the
answer to your question.

> That link you sent is just this thread? Not surewhat you were saying


The link was a link to a section of the documentation that describes
the -logfile startup option.

Just as a small request -- in the future, please quote the relevant section
of the message to which you're replying in your reply. It makes it easier
to remember the context of any follow-up questions for those of us who have
already marked the original question and reply read and don't see it in
their newsreaders.

--
Steve Lord
slord@mathworks.com


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com