Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
Hi everyone,
This is my first post and I hope you can help me.
I have a funtion:
f(x) = 2x and x = 1,2,3,4
I want using a Push Buttom (insert control) export the matrix x, f(x) in a .txt file.
This is posible? what is the script for this?
Hope you can help me.![]()
Thanks in advance
Daniel
What do you want to use the push button for?
Can you not just write the data to a *.txt file as shown in my example?
Mike
Thank you for the answer...
I think in a botton to export the file when I want and not every think the soft calculate, but your answer help me.
I will explain exactly what I want to do.
I have a funtion:
f(x) =2x + 10
And x=1,2,3,4
I want export a .txt with this information:
12 1 $
14 2 $
16 3 $
18 4 $
I am a structural engineer and I need a file like this to import some information in to a structural soft.
All the Best
12 1 $ 14 2 $
16 3 $
18 4 $
Does it have to be in this exact format, because I'm pretty sure if the $ symbol is included the format will have to be changed to a string.
Mike
Yes I have to be in that exact format.
I have an idea have to do it, but I will need you help to accomplished.
I can i create a matrix with f(x) , x?
If I can create a matrix, I can put it in an excel sheet, and i manually type $, because the
amount of "x" will never change so I only need to type the $ one time.
And then I can export it with the file .txt (your example)
All the best
Here.
To modify the script to do what you want change the liine
OutputFile.WriteLine(OutputLine)
to
OutputFile.WriteLine(OutputLine & Delimiter & "$")
and change the delimiter definition at the top of the script to whatever you want.
Hi,
After tried a lot struff, I did what I want to.
The only thing I will like to do, is with a buttom "enable evaluation" and "disable evaluation" of the .txt, so the file only will export when I want it.
Here is the file. Probably you can do the same in one or two steps, but thats the only way I could it think. ![]()
If you want to change it be my guest...
All the best
The only thing I will like to do, is with a buttom "enable evaluation" and "disable evaluation" of the .txt, so the file only will export when I want it.
There is no way to make a button do that for the file output control. At least, no way that wouldn't be at least 100 times as much work as modifying the file write button I just posted!
However, since you seem to be happy adding the $ symbol to the matrix Mathcad, and are currently using a tab as a delimiter, you can just use the button as is to write your file instead of the file output component. ![]()
