Automated way of creating PCODE for distribution purposes while retaining original function documentation
Show older comments
All,
I'm in a position where I would like to distribute a number of functions (i.e., M files) as P-code to a third party. Specifically, I would like to distribute the functionality as P files as I am for various reasons unable to disclose the actual implementation to the third party. However, as far as I can tell, the HELP function is unable to extract the function documentation from a P file so I will additionally need to distribute some kind of "documentation only" M files (akin to, for instance, the way The MathWorks documents the HISTC built-in function).
So far I've relied upon a number of scripts and regular expressions to extract the documentation block from each function out into a separate M file, build the pertinent P-code, and then overwriting (a copy of) the original M file with the documentation one for distribution purposes. This approach works reasonably well for many of my functions, but there is just too much variety in the way documentation occurs (or not) for the approach to be a reliable solution in the long run. If I am to proceed further along this path, I fear I may have to actually parse ever greater amounts of the MATLAB language myself and I am reluctant to take on that challenge.
I guess what I'm wondering is if any of you have experienced a similar situation and found a workable solution. If we were just talking about a handful of functions I'd be inclined to just do the work manually with a text editor and invoking the PCODE function from the command line, but the number of files often exceed 30-40 and I am really looking for a better, automated way of accomplishing this task.
I suppose accessing the built-in MATLAB parser (e.g., from Java-type code) could be used to create a robust solution but I do not know how to do this or even if it is possible at all.
Any and all suggestions are most welcome.
Sincerely,
Bård Skaflestad SINTEF ICT, Applied Mathematics
Accepted Answer
More Answers (0)
Categories
Find more on Scripts in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!