How do I retrieve the names of function parameters in matlab?

前端 未结 6 1241
面向向阳花
面向向阳花 2020-12-01 12:18

Aside from parsing the function file, is there a way to get the names of the input and output arguments to a function in matlab?

For example, given the following fun

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-01 13:19

    When you can't get information from a programming langauge about its contents (e.g., "reflection"), you have to step outside the language.

    Another poster suggested "regular expressions", which always fail when applied to parsing real programs because regexps cannot parse context free langauges.

    To do this reliably, you need a real M language parser, that will give you access to the parse tree. Then this is fairly easy.

    Our DMS Software Reengineering Toolkit has an M language parser available for it, and could do this.

提交回复
热议问题