I am writing a mex library (DLL) that needs to receive data asynchronously and place that data into a fairly complicated mex structure array, containing subarrays and of course value arrays. That structure array can grow or shrink, depending on how much data was received. On invocation of the mex function by the user, the user will get returned the array. For this I have created a secondary thread and also created the array (currently using a maximum static size) and called "mexMakeArrayPersistent" on that array. When the user calls the function, I use "mxDuplicateArray" to return a copy of the array that is marked persistent (to decouple writing to and reading from the array, using an additional mutex requested from secondary thread as well as from Matlab main thread).
Question: If I call "mexMakeArrayPersistent" on the root array, will that also cover all subarrays and value arrays ? Will it also cover removed/added arrays created under the root array ?
Best Answer