This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

mxGPUCopyFromMxArray (C)

Copy mxArray to mxGPUArray

C Syntax

#include "gpu/mxGPUArray.h"
mxGPUArray* mxGPUCopyFromMxArray(mxArray const * const mp)



Pointer to an mxArray that contains either GPU or CPU data.


Pointer to an mxGPUArray.


mxGPUCopyFromMxArray produces a new mxGPUArray object with the same characteristics as the input mxArray.

  • If the input mxArray contains a gpuArray, the output is a new copy of the data on the GPU.

  • If the input mxArray contains numeric or logical CPU data, the output is copied to the GPU.

Either way, this function always allocates memory on the GPU and allocates a new mxGPUArray object on the CPU. Use mxGPUDestroyGPUArray to delete the result when you are done with it.

Introduced in R2013a