From: Rickard Jansson on 3 May 2010 04:17 "Ron Klein" <ron(a)xsights.com> wrote in message <hqv6c8$3pc$1(a)fred.mathworks.com>... > "EBS " <ericDOTsampson(a)gmail.com> wrote in message <hqv1kv$3l0$1(a)fred.mathworks.com>... > > "Ron Klein" <ron(a)xsights.com> wrote in message <hqu22a$4i4$1(a)fred.mathworks.com>... > > > > > > If you or any other person that reads this post have more ideas - please share them. > > > > > > Thanks again for the help so far. > > > > > > Ron > > > > Ron, did you see the post I made earlier? > > > > Check this thread (beware of line wrapping breaking the link), they talk about the undocumented 'mxSerialize' function, and another method using an undocumented SAVE stdio argument: > > http://www.mathworks.com/matlabcentral/newsreader/view_thread/141797 > > Yes, I entered the link you mention, but I couldn't find any code example. > I'll investigate these undocumented functions, that's for sure. > However, if there are some code examples out there (I tried google but nothing came up) - please post them here. > And if, by any chance, somebody actually worked with these functions and could share his/her code - please do. Try pastebin ( http://pastebin.com/ ) for such sharing. > > Thanks all, your help is great and inspiring! > > Ron Hi Ron, I'm working with a similar scenario as you and also tried to use the undocumented mxSerialize/mxDeserialize routines in matlab. I got them to work quite well in the 32-bit Linux version of matlab. But when I used them in the 64-bit version there was some trouble with the mxArray pointers returned from the mxDeserialize function. They seem to somehow become corrupted or truncated. This problem seem to occur when returning a mxArray* type from other functions as well. I might be doing something wrong here but the problem does not exist when running 32-bit matlab. Because of the problems I went looking for another solution and found that functions for serializing and deserializing matlab objects had already been implemented in another project. The mym (http://sourceforge.net/projects/mym) uses this to store matlab objects as binary blobs in a mysql-database. At first I had the same problems as described above with these function because they also returned mxArray pointers, but with the source code available I could try some alternative approaches. Instead I rewrote them to pass the mxArray* pointer where I wanted the results as a parameter to the function. An example: void deserializeStruct(const char* rpSerial, const unsigned long rlength, mxArray** rpOut); This seem to work, but I still haven't figured out why it works this way but not when passing the pointer as a return value. / Rickard
From: Ron Klein on 3 May 2010 05:00 "Rickard Jansson" <rickard.u.jansson(a)gmail.com> wrote in message <hrm0q3$k1o$1(a)fred.mathworks.com>... > "Ron Klein" <ron(a)xsights.com> wrote in message <hqv6c8$3pc$1(a)fred.mathworks.com>... > > "EBS " <ericDOTsampson(a)gmail.com> wrote in message <hqv1kv$3l0$1(a)fred.mathworks.com>... > > > "Ron Klein" <ron(a)xsights.com> wrote in message <hqu22a$4i4$1(a)fred.mathworks.com>... > > > > > > > > If you or any other person that reads this post have more ideas - please share them. > > > > > > > > Thanks again for the help so far. > > > > > > > > Ron > > > > > > Ron, did you see the post I made earlier? > > > > > > Check this thread (beware of line wrapping breaking the link), they talk about the undocumented 'mxSerialize' function, and another method using an undocumented SAVE stdio argument: > > > http://www.mathworks.com/matlabcentral/newsreader/view_thread/141797 > > > > Yes, I entered the link you mention, but I couldn't find any code example. > > I'll investigate these undocumented functions, that's for sure. > > However, if there are some code examples out there (I tried google but nothing came up) - please post them here. > > And if, by any chance, somebody actually worked with these functions and could share his/her code - please do. Try pastebin ( http://pastebin.com/ ) for such sharing. > > > > Thanks all, your help is great and inspiring! > > > > Ron > > Hi Ron, > > I'm working with a similar scenario as you and also tried to use the undocumented mxSerialize/mxDeserialize routines in matlab. > I got them to work quite well in the 32-bit Linux version of matlab. But when I used them in the 64-bit version there was some trouble with the mxArray pointers returned from the mxDeserialize function. They seem to somehow become corrupted or truncated. This problem seem to occur when returning a mxArray* type from other functions as well. I might be doing something wrong here but the problem does not exist when running 32-bit matlab. > > Because of the problems I went looking for another solution and found that functions for serializing and deserializing matlab objects had already been implemented in another project. The mym (http://sourceforge.net/projects/mym) uses this to store matlab objects as binary blobs in a mysql-database. > At first I had the same problems as described above with these function because they also returned mxArray pointers, but with the source code available I could try some alternative approaches. > Instead I rewrote them to pass the mxArray* pointer where I wanted the results as a parameter to the function. > An example: > void deserializeStruct(const char* rpSerial, const unsigned long rlength, mxArray** rpOut); > > This seem to work, but I still haven't figured out why it works this way but not when passing the pointer as a return value. > > / Rickard Hi Rickard, This mym project and link seem to be very helpful. Thumbs up!! Can you share your altered code snippets? Thanks, Ron
First
|
Prev
|
Pages: 1 2 3 4 Prev: combine two matrices Next: Timing of the inversion of a sparse matrix |