How to return a uint64_t from a mex function?
    4 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Shlomo Geva
 am 22 Nov. 2021
  
    
    
    
    
    Kommentiert: Shlomo Geva
 am 22 Nov. 2021
            I want to assign to plhs[0] a scalar of type uint64_t.
Not sure what function to call.
e.g. if I have 
uint64_t y=123;
and I want to return y to Matlab
I tried 
plhs[0] = mxCreateDoubleScalar(y);
But this is not the right call as it is not a double.  How to create a uint64_t variable in the mex function?  in there another mxCreate...   
0 Kommentare
Akzeptierte Antwort
  Bruno Luong
      
      
 am 22 Nov. 2021
        mxArray *A;
A = mxCreateNumericMatrix(1, 1, mxUINT64_CLASS, mxREAL);
*(mxGetUint64s(A)) = 123;
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

