This Excel template provides some basic automation tools for Mathcad, and does not require any additional programming or installation from the user.
Mathcad Excel Tool
- Select a single Mathcad worksheet using a file selector dialog.
- Automatically read inputs, outputs, and default units for a Mathcad worksheet.
- Loop through as many iterations, inputs, and outputs as are supported by Mathcad.
- Override input and outputs units.
- Mathcad Worksheets are never saved. Future releases may allow for you to save the Mathcad worksheet with a specified iteration.
- Ensure correct spelling of variable aliases.
- Ensure correct Mathcad units syntax
- Do not duplicate tables or tabs. The entire Excel document should be duplicated at the file level. This will change in future releases.
- Do not rename tables. However, because tables are used, the template is less sensitive to format changes. For example, you can move a table and it will still work so long as the table name is hasn’t changed.
- It is recommended that you close Mathcad and all open worksheets prior to running scripts in this tool.
- Mathcad Prime 3.1 or later installed
- Designate inputs and outputs in the Mathcad worksheet of interest. See more. The file
Example Worksheet.mcdxbundled with the release shows what an alias list might look like.
- Open the template.
- Click Select Mathcad Worksheet and browse for the file.
- Click Read Mathcad Worksheet.
- Rename and create columns in
OutputsTablefor each enabled row in
- Add input values in
InputsTablefor each alias and iteration.
- Click Iterate to begin iterating. Outputs will populate the
OutputsTable. This operation could take a while.
- Select Mathcad Worksheet - Opens a file dialog to select the location of the Mathcad worksheet. Network drives are allowable, but may not be as fast as local.
- Read Mathcad Worksheet - Reads the selected worksheet file for inputs and outputs, then populates the inputs and outputs table with default units and initial values.
- Iterate - Runs all iterations in the iteration table.
- Clear Outputs - Clears the values in the outputs columns in the iteration table.
- Reset - Clears all tables and the Mathcad worksheet path.
All tables in this template are true structured tables. I highly recommend using right-click operations on tables in order to change their size.
MCOutputsTable- Show the inputs and outputs defined in the Mathcad worksheet after running
Read Mathcad Worksheet. Allows for some granular control.
Alias- Name of variable define in Mathcad.
Value- Existing value of the variable in the worksheet.
Units- Units of the default value.
Units2- Units of the column in the iteration table.
1for enabled. Boolean value to enable the column in the iteration table. Disabled inputs will use the default value and units listed for that input. Rows that are enabled must have a corresponding column of the same alias in
Status- Displays error messages. They appear in the order below, as only one is shown at a time.
MISSING COLUMN - Shows if an enabled input/output is missing a column in
MISSING UNITS - Shows if an enabled column is missing a value in
Units2. The default units cannot be used if the row is enabled, but they can be manually copied over.
- MISSING COLUMN - Shows if an enabled input/output is missing a column in
IterationsTable- Where you store information about each iteration. The ID and Description are for your information only. They do not influence calculations, and additional columns may be added to your liking.
InputsTable- Where input data is stored for each iteration. You may include more columns than there are inputs/outputs designated in the Mathcad worksheet, since the
MCOutputsTablecontrol which are enabled.
This tutorial walks you through an example Mathcad worksheet bundled with the release download. Begin by opening the downloaded Excel file.
- You may need to click Enable Content in order to trust this document.
- An additional dialog may pop up if you opened the file from a cloud location. This allows the VBA scripts inside the spreadsheet to run. If this did not occur, proceed.
- Click Select Mathcad Worksheet and browse to
Example Worksheet.mcdx, which comes bundled with the release. Double click on the worksheet or single click, and then click Open.
- Click Read Mathcad Worksheet. An additional dialog will ask to confirm that you would like to clear
OutputsTablewill remain as-is.
- You should see the below data now populated inside
MCOutputsTable. This shows all of the designated inputs and outputs of the worksheet, their current value, and units. Note that
- Fill in the tables with the following data.
InputsTablehas been prepopulated with
20iterations of values for
- Click Iterate to begin the loop. Outputs should begin appearing in
- Automatically build tables based on pre-defined Mathcad inputs and outputs
- Clear outputs button
- Try/Catch all API calls
- Data validation
- Allow for tab duplication
- Matrix support