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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

User defined functions accessible from multiple worksheets.

SamDilworth
1-Visitor

User defined functions accessible from multiple worksheets.

Is there a way to create user defined functions in such a way that they can be accessed from a new worksheet that doesn't have the funciton defined in that workspace, essentially to have it behave like a built in function? If this cannot be directly achieved in Mathcad 15, how else would you go about doing this? I want to start with a very basic function like logarthic temperature difference (LMTD)


LMTD(t2,t1) := (t2-t1) / (ln(t2/t1))

such that in a new worksheet I could only have to type

LMTD(25,50) =

and get my answer of 36.067 without having to define LMTD in every worksheet I use.

Thanks

3 REPLIES 3
Werner_E
25-Diamond I
(To:SamDilworth)

You can insert a reference to the worksheet with your functions on top of the new WS. So you can use your functions as demanded.

From MC15 help:

Including One Worksheet Inside Another

You can insert a reference to a worksheet, which makes the current worksheet behave as if you had inserted the actual regions from the referenced worksheet.

To insert a reference to a worksheet:

  1. Choose Reference from the Insert menu to display the Insert Reference dialog.
  2. Click "Browse" to locate and select a worksheet or type the complete path or Internet address (URL) to a worksheet, such as:

    C:\Program Files\Mathsoft\Mathcad\conform.xmcd

    http://www.ptc.com/go/mathsoft/coeffs.xmcd

  3. Choose "Use relative path for reference" if you want a relative path. You must save the file containing the reference before setting a relative path.

Upon completing these steps, you see an icon,

referenced worksheet icon

with the name of the referenced worksheet. The referenced worksheet's definitions and functions take effect at this point, just as if you had copied them into the worksheet. Double-click the icon to view the referenced worksheet.

In version 15 (and before) it was possible to create a template that you could open as a "blank" worksheet. You could create an "area" in that worksheet and define constants and functions in that area, then collapse the area (and the constants and functions would magically disappear). Then, every time you opened a new sheet from that template the constants and functions would be there, hidden, in the collapsed area. Ready to use.

Prime does not (yet) have that capability.

This is the approach that I use. I like it because it is portable -- I can just carry a template around with me (e.g., from installation to installation) without having to worry about an extra worksheet. Clearly, though, Werner's approach will also work -- personal preference.

Announcements

Top Tags