I have a variable x, a gpuArray. I call a mex function func(x). In the mex function, I want to reshape this variable.
The only mex function relevant seems to be "mxSetDimensions". I tried it in a way like this
mxSetDimensions((mxArray *) in[0], new_size, (size_t) 4 );
where "in" is the input argument of mexFunction(...)
It didn't work and corrupted my variable. After I call this mex file, I cannot even get the size of this variable.
>> size(x)
Error using gpuArray/size
Invalid number of objects.
Ideally, I don't want to duplicate the array, since this array maybe very large and this function is required to be as fast as possible. Why does one have to duplicate an array to reshape it? After reshaping it will be used later in the mex file.
Could someone help me? Thanks!