export_matrix#
- Maxwell2d.export_matrix(matrix_name: str, output_file: str | Path, setup: str | None = None, is_post_processed: bool | None = False, default_adaptive: str | None = 'LastAdaptive', is_format_default: bool | None = True, width: int | None = 12, precision: int | None = 6, is_exponential: bool | None = False, use_independent_nominal_values: bool | None = True) bool#
Export matrix after solving.
This method exports matrix data from the Matrix tab in the Solutions window to a .txt file.
- Parameters:
- matrix_name
str Matrix name to be exported.
- output_file
orpathlib.Path Output file path to export matrix file to. Extension must be
.txt.- is_format_defaultbool,
optional Whether the exported format is default or not. If False the custom format is set (no exponential).
- width
int,optional Column width.
- precision
int,optional Decimal precision number.
- is_exponentialbool,
optional Whether the format number is exponential or not.
- setup
str,optional Name of the setup. If not provided, the active setup is used.
- default_adaptive
str,optional Adaptive setup name. The default is
"LastAdaptive".- is_post_processedbool,
optional Boolean to check if it is post processed. The default value is
False.- use_independent_nominal_valuesbool,
optional Whether to use independent nominal values when retrieving variations. The default value is
True.
- matrix_name
- Returns:
- bool
Truewhen successful,Falsewhen failed.
References
>>> oanalysis.ExportSolnData
Examples
The following example shows how to export capacitance matrix from an Electrostatic solution.
>>> from ansys.aedt.core import Maxwell3d >>> m3d = Maxwell3d(version="2025.2", solution_type="Electrostatic", new_desktop=False) >>> up_plate = m3d.modeler.create_box(origin=[0, 0, 3], sizes=[25, 25, 2], material="pec") >>> gap = m3d.modeler.create_box(origin=[0, 0, 2], sizes=[25, 25, 1], material="vacuum") >>> down_plate = m3d.modeler.create_box(origin=[0, 0, 0], sizes=[25, 25, 2], material="pec") >>> voltage1 = m3d.assign_voltage(assignment=down_plate.name, amplitude="0V", name="voltage1") >>> voltage2 = m3d.assign_voltage(assignment=up_plate.name, amplitude="1V", name="voltage2") >>> # set matrix and analyze >>> matrix = m3d.assign_matrix(assignment=[voltage1.name, voltage2.name], matrix_name="Matrix") >>> setup = m3d.create_setup() >>> setup.analyze() >>> # Export C Matrix after solving >>> m3d.export_matrix(matrix_name=matrix.name, output_file=Path(m3d.working_directory) / "C_matrix.txt") >>> m3d.desktop_class.close_desktop()