Is it possible to intercept a matlab save() bytestream

前端 未结 10 2334
暖寄归人
暖寄归人 2020-12-09 22:50

In matlab it is possible to write matlab objects, or even the entire workspace, to a file using the matlab save() call. I would like to intercept the bytestream and postproc

10条回答
  •  时光说笑
    2020-12-09 23:16

    I am also interested on this problem. I found some things, but nothing works:

    • matlab save stdio you find this hidden feature, but it doesn't work
    • engGetArray/engPutArray "This routine allows you to copy a variable out of the workspace."

    Look at MAT files specification, maybe we can reproduce matlab serialization with a Mex file:

    • http://www.eiscat.se/groups/Documentation/UserGuides/matlab4.pdf

    Update:

    I found something very interesting: run in Matlab console this command

    edit([matlabroot '/extern/examples/eng_mat/matcreat.c']);
    

    or this

    edit([matlabroot '/extern/examples/eng_mat/matcreat.cpp']);
    

    This is the documentation, how to compile it: http://www.mathworks.com/help/techdoc/matlab_external/f14500.html

    In my opinion it should be feasible to use STDOUT in pmat = matOpen(file, "w"); command.

提交回复
热议问题