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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

How do i get mathcad to output text data files

jpilling
1-Visitor

How do i get mathcad to output text data files

I have a complex design program written in Mathcad 14 (15). I create 3 HTML formatted outputs - each output is stored in a variable. In Mathcad 14/15 I pass these variables along with a user chosen filename to a scriptable button. The script then takes the data and writes out the 3 HTML formatted files to the hard drive, appending a time stamp to the HTML and adding an extension to the selected file names. Works great!

Now the problem is that Prime 3 no longer supports the scriptable buttons and the read/write functions in mathcad will only let one write out matrices of numbers - they will not write out a string variable. I have tried to work around the problem by creating an excel component, passing in the data into cells and then adding a button to the excel component that when clicked executes a VBscript macro. The issue is that Prime 3 hangs up and does not return to Mathcad with the time stamp that lets me know the files were written out. In fact any excel component that executes VBscript ( and I have 4 in my document) will not return the result to mathcad - they just hang up - even though it looks like the macro has executed.

Is there any way that mathcad can have a built in write function that writes out  string data to a file that does not already exist on the hard drive?

FRUSTRATED!

ACCEPTED SOLUTION

Accepted Solutions
LucMeekes
23-Emerald III
(To:jpilling)

You can use the WRITEBIN() function, after convering the strings to vectors of numbers with str2vec().

{Which should work the same in Mathcad 14/15, by the way.}

Success!

Luc

View solution in original post

9 REPLIES 9
LucMeekes
23-Emerald III
(To:jpilling)

You can use the WRITEBIN() function, after convering the strings to vectors of numbers with str2vec().

{Which should work the same in Mathcad 14/15, by the way.}

Success!

Luc

LucMeekes
23-Emerald III
(To:LucMeekes)

But there may be better ways.

I see that Prime 3.1 has the function WRITETEXT().

Go ahead and see if it is available in Prime 3.0 and if this works for you.

Success!

Luc

LucMeekes
23-Emerald III
(To:LucMeekes)

The function WRITETEXT() will probably not work for you, because it encloses all strings in "quotes".

So use WRITEBIN(), that gives you full control over what you write. You can even insert control characters into your strings if you need.

Success!
Luc

Thanks - that works! Now all I need to do is work out how to get the timestamp added in and i'll be good to go.

John,

with Mathcad Prime commercial license you can install and run Mathcad 15. Therefore I do not understand why are you translating old working worksheet into Mathcad Prime ...

MH


Martin Hanák
LucMeekes
23-Emerald III
(To:MartinHanak)

I guess some people always want to use the lastest version of any software, even if it's complete crap.

And some people have no choice, they work in a company with an IT department that dictates what tools to use...

Luc

Exactly. The IT department of the company wants to transition to Prime. I think MathCAD 15 is a great product and with the buttons/controls, that are not in the Prime version, offers the possibility of the non-technical user being able to make input choices and get answers without having to know how the mathcad document works.  Also 15 is substantially faster, so much so that the company is going to have to get me a new laptop as prime 3 is virtually unusable on my existing machine but 15 works in an instant. The document used to run on the mathcad app server via the web so engineers out in the field could access it without each having to have an individual copy of Mathcad. Sadly - no longer offered by PTC. For now we engineers are sticking with 15!!!!!

LucMeekes
23-Emerald III
(To:jpilling)

"Exactly. The IT department of the company wants to transition to Prime."

As it (still) stands, currently, that's only half-way back to pencil, paper and slide rule. But that's just my personal opinion...

I think it's sad that IT departments, those who do not use the tools, can have such a big say in this.

Strength!

Luc

Announcements

Top Tags