cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Trying to output function to a text or excel file

RatherB.Fishing
1-Newbie

Trying to output function to a text or excel file

I've tried many approaches in Prime 2.0 to output the result of a function to a file for use in another application.

There seems to be little that's intuitive about Prime, and no information about exporting data.

I need to export the result of a function F(t,n) where t and n are not integers. Seems i have to create a matrix to do this. But all attempts fail for one reason or another.

Writing it as a program it won't let me assign the output of the function to a matrix column as a declaration, and as a declaration statement; I have to use the matrix integers as part of the function. But since they aren't integers, it can't be done. Do I have to rewrite this to convert the integers of a matrix to be the variables in the equations? As in MathCAD can't work with floating point numbers directly in a matrix?

if t:= 0, T/1000..T n = 10

F(t,n):= a summtion as variable approaches n

Why can't I assign a matrix[x,0] := t

matrix[x,1]:=F(t,n)

then use WRITEFILE to output the info?

I'm about to just program this in Visual Studio and skip mathCAD completly... it shouldn't be this hard. I've talked to other MathCAD users and none of them can figure it out either.

5 REPLIES 5

You are defining t as some kind of range variable, but it should be a vector for your purpose.

I've defined j:=0..1000, and then t[j:=j*T/1000.

Other details are shown in the attachment.

Not sure what you are trying to do.

in your attempts to write files you are trying to write matrices which do not exit so Mathcad of course does not know what to write. You are using indices in matrix which are not defined.

Your program block doesn't do anything and would fail if you try to do so, as you cannot just write M[k,l. What shoul Mathcad do? You cannot assign a column in a Matrix using the column selector - thats for slecting a column in an existing matrix, not for builing a matrix (you would rather use something like augment).

Must most import af all you will have to learn the difference between a range variable (your t) and a vector (that what you obviously want t to be). While they may look the same they aren't.

Look if the attached would get you in the right direction

Obviously the program block is not complete - if it were I wouldn't be asking.

I'll brute force the matrix by using the equation for t in the function then I can assign that in the matrix.

This is just an awkward, method for creating th output. The plot shows the functions output, but it can't be output that way. I was looking for the better way get the plot data to a file.

I'll assume there is none, and rewrite the function so it won't cause a error in the matrix.

Have you looked at my attached file?

I think it does what you want.

If not, what is it missing?

I was looking for the better way get the plot data to a file.

I'll assume there is none, and rewrite the function so it won't cause a error in the matrix.

Hm, did you look at the files posted? I showed three methods for creating the matrix you seemed to be striving for and Micheal has shown even another method along with how to write the data to a file and retrieve it again.

Looking again at your original file it seems you were trying to achieve just that. Maybe you wanted an additional column with a integer sequence from 0 to 999?

Top Tags