Skip to main content
Tweeted twitter.com/StackMma/status/746151813582290947
t cannot be supplied manually
Source Link

I am writing a C code for solving a big set of differential equations. I am trying to use Mathematica to export some of the long expressions to C. I would like to know how I could use Write[stream, expression] without adding a newline character. An example of what I exactly want is as follows.

t=0;    
str=OpenWrite["file path"];
   WriteString[str, "A[" ]; Write[str,0t ]; WriteString[str, "] = 0;"];

I want this to be printed into the file as

A[0] = 0;

instead of

A[0
] = 0;

IfAlso, the parameter t cannot be supplied manually. "t" is set before passing it as an argument to Write or some other similar function.If this cannot work, is there any other way of doing this ?

Thanks . Thanks

I am writing a C code for solving a big set of differential equations. I am trying to use Mathematica to export some of the long expressions to C. I would like to know how I could use Write[stream, expression] without adding a newline character. An example of what I exactly want is as follows.

str=OpenWrite["file path"];
WriteString[str, "A[" ]; Write[str,0 ]; WriteString[str, "] = 0;"];

I want this to be printed into the file as

A[0] = 0;

instead of

A[0
] = 0;

If this cannot work, is there any other way of doing this ?

Thanks

I am writing a C code for solving a big set of differential equations. I am trying to use Mathematica to export some of the long expressions to C. I would like to know how I could use Write[stream, expression] without adding a newline character. An example of what I exactly want is as follows.

t=0;    
str=OpenWrite["file path"];
   WriteString[str, "A[" ]; Write[str,t ]; WriteString[str, "] = 0;"];

I want this to be printed into the file as

A[0] = 0;

instead of

A[0
] = 0;

Also, the parameter t cannot be supplied manually. "t" is set before passing it as an argument to Write or some other similar function.If this cannot work, is there any other way of doing this ? . Thanks

Source Link

How to use Write[stream, expression] without automatic addition of next line character

I am writing a C code for solving a big set of differential equations. I am trying to use Mathematica to export some of the long expressions to C. I would like to know how I could use Write[stream, expression] without adding a newline character. An example of what I exactly want is as follows.

str=OpenWrite["file path"];
WriteString[str, "A[" ]; Write[str,0 ]; WriteString[str, "] = 0;"];

I want this to be printed into the file as

A[0] = 0;

instead of

A[0
] = 0;

If this cannot work, is there any other way of doing this ?

Thanks