how to retain a variable in memory in mex function after its execution
Ältere Kommentare anzeigen
Hi everybody,
I want to use a mex fucntion in Matlab. My requirement is that i have a matrix in Matlab that should be processed by a mex function using different arguments generated in loop in Matlab. In order to save execution time i do not want to pass the matrix to the mex function in every loop as the matrix is very large.
Is it possible to transfer the matrix for once to a fixed location in memory, so that the mex function can access it during every execution and is retained at the same location even after the call to the mex function.
Akzeptierte Antwort
Weitere Antworten (1)
Jan
am 11 Mai 2014
2 Stimmen
You can use mxMakeMemoryPersistent or mxMakeArrayPersistent as well as the usual static property of C-variables.
1 Kommentar
mohsan niaz
am 15 Mai 2014
Kategorien
Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!