Tagged Questions

A source of input or output: files and pipes are both examples of general Mathematica objects known as streams.

learn more… | top users | synonyms

0
votes
1answer
59 views

ReadList can't read “.csv” data with correct line number?

Well, the problem was solved today. Since "testAll.csv" is generated by Java/Eclipse, and I noticed that the LineSeperator is ...
1
vote
3answers
142 views

How to import files with headers?

R has excellent header supports such as read.table with header options. I don't want to mess up with text-processing or stream-processing. I am looking for a similar tool as in R because it saves a ...
2
votes
0answers
44 views

ScheduledTask output redirection

When a function is run repeatedly within a ScheduledTask its output is sent to Messages Window. When two or more ScheduledTasks are running their outputs are mixed in the Messages Window and this is ...
2
votes
1answer
63 views

How to read from /dev/random?

I am looking to read a few bytes from /dev/random on OS X and Linux. The simplest approach fails on both operating systems (see below). Why? What is a ...
11
votes
2answers
200 views

ToExpression fails with long nested string expressions

Consider the following conversion from String to Mathematica Expression: ...
3
votes
1answer
71 views

EndOfFile error

I have a LARGE file (14.6 GB) that I want to separate into several smaller files. Because of its size, using Import/Export is not feasible, I think the most reasonable way of handling this would be ...
2
votes
0answers
17 views

In a Function, how to Ensure Code Runs Prior to an Abort [duplicate]

Is there a way to set aside some code in a function that will be triggered to run if the evaluation of the function is aborted by a user? Specifically, I have a function that has to open a log file to ...
1
vote
3answers
389 views

How to export data to a plain text file?

I am preparing data used by a command line program. It requires data in a simpliest possible format: value_x1 value_y1 value_x2 value_y2 ... value_xN value_yN ...
2
votes
1answer
125 views

Importing a Base64 encoded string

everyone, I'm handling some paragraphs enconded with Base64 from CSV file format. The problem is that Mathematica can't decode it. It seems Mathematica Encode/Decode their own Base64. I'm thinking ...
4
votes
4answers
116 views

How can I close a stream without knowing its name?

If I initialise a stream as follows OpenWrite["~/example"] How do I close this stream? Close seems to expect a name, but I ...
3
votes
1answer
88 views

CountryData et al. and associated InputStream

Quick update I found a way to solve this in webMathematica, using CollectStreams. But still, below problem leaves me puzzled, I would very much like to learn how ...
1
vote
0answers
56 views

Getting InputStream errors when including a call to ElementData within an Import definition

So I am writing an ImportExport converter for a common chemistry file format, and I've run up against a problem that seems to be about shared streams and whatnot. ...
2
votes
1answer
63 views

Followup question from "Temporarily redirect output of Print[ ] to a second file

I'm implementing the first answer to my earlier question about redirecting the output of Print[ ]. Opening a file with OpenWrite[] and assigning the stream to ...
5
votes
2answers
138 views

Short circuit logical operators [duplicate]

Suppose I want to compute $f(1)\vee f(2) \vee \ldots \vee f(10^{10})$, but I know a priori that $f(n)$ is True for some $n \ll 10^{10}$ with high probability. For ...
1
vote
0answers
139 views

Opening a pipe with OpenRead

My question is if it is possible to directly open a (named) pipe using OpenRead. Introduction In the docs of OpenRead, we have, under details and options, If ...
2
votes
1answer
107 views
3
votes
1answer
229 views

Write and Read to StreamPosition

One OutputStream and one InputStream are opened on the same file: ...
3
votes
0answers
73 views

Reading a specified line number from a text file [duplicate]

Possible Duplicate: How to read data file quickly? I have a huge text file (~500 MB). The file is too large to Import into Mathematica, although I can ...
3
votes
1answer
123 views

Directing output of PrintTemporary to an additional OutputStream

I want to log messages that I send to the screen, even temporary ones. By setting $Output appropriately, it is possible to log ...
4
votes
4answers
250 views
3
votes
1answer
207 views

Efficiently importing XPM matrix data into Mathematica

The XPM file format is an image file format. Although it is primarily intended for icon pixmaps, it can also be used to store matrix data. For example, the GROMACS chemical simulation package uses ...
3
votes
1answer
243 views

How to write output to an external text file in addition to the standard output stream?

How to write output to an external text file in addition to the standard output stream, i.e. a notebook for a session with FE and stdout for command-line session?
9
votes
2answers
217 views

How to record the stream of data (PixelPosition) dynamically?

I need to trace the moving of an object and get the coordinates of such movement. The set of coordinates will be used for the subsequent evaluation and analysis. I can easy get the current real-time ...
6
votes
1answer
691 views

Stream CSV files

Ram limitations make import impractical for large CSV files. Is it possible to Stream CSV correctly? ...
7
votes
1answer
195 views

How do I re-direct FilePrint's output?

I recently wanted to use FilePrint to print the contents somewhere else but in the notebook I was using. However, the obvious-seeming solution doesn't work at all: ...
3
votes
0answers
95 views

How do I direct output to a specific notebook or cell? [duplicate]

Possible Duplicate: How to pipe a stream to another notebook? Is there any way to create a stream so that all output to the stream (from Write or ...
10
votes
1answer
551 views

How to generate a real-time stream of data?

I'm experimenting with Inversion-of-Control (callback) programming patterns, and I would like a way to generate streams of data at specified real-time intervals. I came up with the illustrated way to ...
7
votes
3answers
501 views

Reading from a stream of strings and numbers delimited by commas

I am trying to read from a stream of strings and numbers delimited by commas similar to the way I have read from a stream of strings and numbers delimited by spaces. Example delimited by spaces ...
10
votes
2answers
782 views

Creating a realtime MIDI Out

I have a live stream of notes and note velocities using SoundNote and SoundVolume. My problem is that I have no idea how to ...
4
votes
1answer
665 views

Why these (error) messages?

Testing this answer I used: stream = OpenWrite["A:\\out.txt"]; Block[{$Messages = stream}, Mod[1, 2, 3, 4, 5] ] and I was surprised to find that the contents ...
10
votes
2answers
207 views

How to Write into multiple files?

Note: this is fixed in version 9. I want to put expressions into multiple files simultaneously, with the following code: ...
9
votes
1answer
391 views

How to pipe a stream to another notebook?

Can I pipe an OutputStream object created by OpenWrite (or similar) to a notebook instead of a file? I am aware that I can use ...