.. highlightlang:: us .. index:: XYZCreateFromMatrix .. _xyzcreatefrommatrix: XYZCreateFromMatrix =================== .. us.tag XYZCreateFromMatrix ENGLISH :ref:`XYZCreateFromMatrix` creates a 3D dataset. .. function:: hData = XYZCreateFromMatrix(ssName, rmZ, rvRange) .. us.return **Return Value** *hData* is the handle of the dataset. If the dataset cannot be created *hData* is 0. .. us.params **Parameters** .. uparam:: ssName *ssName* is a scalar string. .. uparam:: rmZ *rmZ* is a matrix with z-values. .. uparam:: rvRange *rvRange* is a vector with 4 elements that set the range of the z-matrix on the xy-plane. *rvRange* is built as the following: rvRange = [rsXmin, rsYmin, rsXmax, rsYmax]. *rsXmin* must be smaller than *rsXmax* and *rsYmin* must be smaller as *rsYmax*. .. us.comment **Comment** The matrix must have a minimum of 2 ``*`` 2 elements. The matrix does not have to be square. See also :ref:`XYZCreate` if the matrix is measured at certain x- and y-coordinates. .. us.example **Example** Copy the following example into an UniPlot Editor (:ref:`file-new` ``[Program Editor]``) and choose :ref:`uniscript-save-execute` to execute the script. :: x = linspace(-10, 6.0, 30); y = linspace(-10, 5.0, 30); = meshdom(x,y); zz = sin(sqrt(xx.*xx + yy.*yy)) + sin(xx); rvRange = [x[1], y[1], x[len(x)], y[len(y)]]; hData = XYZCreateFromMatrix("sin", zz, rvRange); hLayer = LayerCreate(); hDoc = DocCreate(); hPage = PageCreate(); DocAddPage(hDoc, hPage); PageAddLayer(hPage, hLayer); LayerAddDataset(hLayer, hData); LayerAutoScale(hLayer); PageReplot(hPage); .. seealso:: :ref:`overview-xyz-datasets`, :ref:`XYZDestroy`, :ref:`XYZCreate`, :ref:`LayerAddDataset`, :ref:`XYZSetInterRange` :sub:`id-898700`