set_vec#

AnsMath.set_vec(data, name=None)#

Push a NumPy array or a Python list to the MAPDL memory workspace.

Parameters:
datanp.ndarray, list

NumPy array or Python list to push to MAPDL. It must be one dimensional.

namestr, optional

AnsMath vector name. The default is None, in which case a name is automatically generated.

Returns:
AnsVec

AnsMath vector instance generated from the pushed vector.

Examples

Push a random vector from NumPy to MAPDL.

>>> data = np.random.random(10)
>>> vec = mm.set_vec(data)
>>> np.isclose(vec.asarray(), data)
True