m-file in Simulink
m-file in Simulink
(OP)
Hi,
I would like to include m-file into Simulink workspace. Should I use 'Level-2 M-file S-Function' block, if yes, how it must be used if I want to include two variables, one is a number and second is a text.
I could simply use m-file in Matlab command window and calculate what I need, but as I would like to include m-file into Simulink model.
I would like to include m-file into Simulink workspace. Should I use 'Level-2 M-file S-Function' block, if yes, how it must be used if I want to include two variables, one is a number and second is a text.
I could simply use m-file in Matlab command window and calculate what I need, but as I would like to include m-file into Simulink model.
RE: m-file in Simulink
If you don't have the toolbox you can use an S-function. Although, you would have to convert your M-code to C-code...
Fe
RE: m-file in Simulink
Another way of doing that is to create a user function block, which would appear to limit you to one input and one output, but I see no reason why you couldn't MUX multiple inputs into a vector. I'll try that when I am next on a suitable box.
Cheers
Greg Locock
New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?
RE: m-file in Simulink
RE: m-file in Simulink
OP,
The"user function block" is the same as an "embedded function block". Which can handle any amount of inputs and outputs all in m-code.
Actually this is much simpler than an S-fcuntion for bergineers.
But, S-functions are far more powerful. (embedded only allows some external functions to be utilized) (whereas an m-file s-function can solve any n-order runge kutta DE as well as basic computations. ect.
Fe
RE: m-file in Simulink
it consists of two inputs, one is integer and second is char. The output is also char.
RE: m-file in Simulink
Cheers
Greg Locock
New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?