From: James Tursa on
"Balint Takacs" <b.takacs(a)imperial.ac.uk> wrote in message <i3achv$fue$1(a)fred.mathworks.com>...
>
> The only way to avoid this if one could somehow guess from the mxArray* itself that it is part of a cell array. Is there a way to do that? I mean apart from exhaustively searching through all available cells...

I am unaware of anything in the mxArray header information, official or even behind-the-scenes unofficial, that you can test to see if the mxArray is a cell from a cell array. You would have to keep track of that yourself as a programmer, maybe keeping this bookkeeping as part of your class.

> In any case, the API should be changed in a way that mxDestroyArray does not work on cell elements (should not fail the program, just return a special value).

But in some cases the user might want to do just that, as in my example from an earlier post.

And since there is likely nothing in the mxArray itself to indicate this status, my guess is it would not be easy for MATLAB to implement such a test inside the mxGetCell function.

IMO, having mxGetCell etc. not making a deep copy is the desired behavior since that makes for faster resource-efficient code. I don't mind doing the bookkeeping myself to keep track of what needs to be destroyed and when. On the other hand, the new mxGetProperty function is a problem if the underlying data is very large. It can be a tremendous drag on performance.


James Tursa
 | 
Pages: 1
Prev: AVGPOWER
Next: HELP me find AVGPOWER