MATLAB Component |
In addition to importing and exporting MATLAB data files using the File Input, File Output, or Data Table components, you can also use the MATLAB component to execute MATLAB scripts using data from your Mathcad worksheet, and return the results to Mathcad.
![]() |
Inserting A MATLAB Component |
To insert a MATLAB component into your worksheet, you must have MATLAB Professional version 4.2c or higher or MATLAB Student version 5.0 or higher installed. Unlike some other components, there is no wizard for the MATLAB component; all customization occurs in the worksheet.
![]() |
Configuring a MATLAB component |
The Properties page for the MATLAB component allows you to change the MATLAB variable name corresponding to each input and output variable. By default, the input variables are sent into MATLAB variables named in0, in1, in2, and in3, and the MATLAB variables out0, out1, out2, and out3 define the output variables. To change the name of the MATLAB variable you want to access, Select the appropriate tab in the Properties dialog, click in the text field you want to change and enter a new name. If the field you want to edit is unavailable, you must first add the appropriate variable to the component.
To change the number of input and/or output variables associated with the component, right-click on the MATLAB component and use the menu to add or remove inputs and outputs as necessary. The MATLAB component is limited to a maximum of four inputs and four outputs.
The MATLAB component works with MATLAB .M files. Right-clicking on the component and choosing Edit Script opens the script editor, where you can make your edits. Unlike the other application components, you cannot double-click on the component itself to access the associated application.
By default, the component is created with no associated file; to base the component on a particular file, open the script editor, choose Import from the File menu, and open the file you want to use.