Problem with mxGetScalar in mex function cuda

8 visualizaciones (últimos 30 días)
davide
davide el 31 de Mayo de 2014
Comentada: davide el 2 de Jun. de 2014
Hi *,
i've three different files: main.m makeOperator.m makeOperator_A.cu
In main.m:
global DICTIONARY
load('data.mat');
A = makeOperator();
x = rand( size(A,2), 1, 'double' );
R = A*x;
In makeOperator.m:
classdef makeOperator
properties
methods
..
function v = mtimes( obj, x )
global DICTIONARY
..
v = makeOperator_A( DICTIONARY);
end
..
end
In makeOperator_A.cu:
void mexFunction(int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[]) {
mxArray* tmp;
..
tmp = mxGetField(prhs[0],0,"nV");
nV = mxGetScalar(tmp);
..
}
Whit mxGetScalar(tmp) i obtain nV=0 instead of nV=72 that is the true value of nV saved in DICTIONARY.nV
Why?
Thanks,
Davide
  2 comentarios
James Tursa
James Tursa el 31 de Mayo de 2014
Where is DICTIONARY coming from? The mat file? I don't see anything in your posted code that sets DICTIONAR.nV = 72.
davide
davide el 2 de Jun. de 2014
DICTIONARY is in data.mat. DICTIONARY is a struct and nV is a field of a struct

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Write C Functions Callable from MATLAB (MEX Files) en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by