MATLAB: Matlab struct to gpuArray

gpuParallel Computing Toolbox

Is it possible to transfer a matlab struct to the GPU? So for example is something like this possible:
s.a = 1
s.b = [1; 2; 3]
s.c = []
s.d = 5
sgpu = gpuArray(s)

Best Answer

You cannot make a structure on the gpu, but you can make a structure containing gpuArrays.
s.a = gpuArray(1)
s.b = gpuArray([1; 2; 3]);
...