MATLAB code that reads in an logic code input file
显示 更早的评论
Is there MATLAB code/pseudocode that reads in a text input file containing basic user-defined logic code (ie, if-then-else, while-do, etc), then MATLAB itself interprets that logic program code and applies that code onto existing data structures within MATLAB. In a way, the MATLAB m-file becomes a run-time compiler for the user-defined text input file. Currently, any logic must be coded into the m-file ahead of time in the m-file. In this way, the logic applied to a data array/structure can be defined on the fly.
采纳的回答
更多回答(1 个)
Guillaume
2016-2-28
0 个投票
"a text input file containing basic user-defined logic code (ie, if-then-else, while-do, etc)" is the definition of a m-file. It's possible to call a user supplied m-file from your own m-file if you wish. You may have to play around with the matlab path if the file can be located in any directory. (but it's never very wise to run any arbitrary user-supplied code)
Or are you asking for some sort of simplified language that matlab could interpret. There is no such thing built-in and for us to even give you any pointer you would have to first define the grammar of such language.
2 个评论
rayjoe
2016-2-28
Guillaume
2016-2-28
Possibly, you're looking to implement a finite state machine engine.
As far as I know, there a toolbox for simulink that does this. (I know nothing about it, or simulink for that matter), but implementing a state machine engine in matlab should not be too difficult.
But again, we need to have an idea of the kind of logic you want to implement.
类别
在 帮助中心 和 File Exchange 中查找有关 Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!