MATLAB: provide feature sharing

I wrote a standalone MATLAB function myfun.m, and I would like to share it with people who also have MATLAB. They can use the function, but I do not want them to see what is inside the function.

So far, I have seen one way to do this with pcode: I would create myfun.pwith pcode('myfun.m'), then I would divide myfun.pinto people. Is it correct?

The above approach has two problems:

  • When I type help myfun, I get No help found for myfun.p., although I created a short help for the original .m (via a comment right after the function declaration)
  • mathworks says the .p file contains a hidden rather than an encrypted version of the original .m

Is there any other approach besides pcodethat fixes one or both of the problems above?

+4
source share
1 answer
  • All comments are deleted when a file is created .pfrom a file .m, including all help text. If you want to provide help text for your .pfile, you can create a separate file .mwith the same name as the file .pcontaining only the help text. Due to the order in which the function is resolved, the file .pwill be evaluated when it is used programmatically, and the file .mwill be referenced when searching for help.

    Pay attention to organize files .pand .min the following table from Mathworks:

    MATLAB :

    • MEX-
    • Simulink, , :
    • SLX
    • MDL
    • (.mlapp), MATLAB App Designer
    • .mlx
    • P ( .p)
    • .m
  • , .p , , , , . , , .m .p, .m, , .

    , mex .

+5

Source: https://habr.com/ru/post/1657541/


All Articles