MATLAB Answers


converting M-file into a block function in simulink

Asked by dong van duc on 15 Aug 2012
Latest activity Answered by karishma kousar on 1 Apr 2016
hello can you show me how to move "file.m" into a function block in simulink thank you!


what do you mean?
I want to know all the "file.m" transformed into a block in "simulink"?

Sign in to comment.



3 Answers

Answer by Kaustubha Govind on 15 Aug 2012
Edited by John Kelly on 26 Feb 2015
 Accepted Answer

You can call the function from any of three MATLAB Function blocks.


I use a block "Level-2 M-file S-Function", M-file name = duong_truyen, I get a error: "Eroor due to multiple causes --> Too many input arguments.-->Error evaluating the initialization for M-S-Function 'duong_truyen'.Too many input arguments.The following is the MATLAB call stack (file names and line numbers) that produced this error:"
Please start a new question and paste your code and the error message with the stack as well.
yes, I created a new question.

Sign in to comment.

Answer by Youssef Haical on 5 Sep 2014
Edited by Youssef Haical on 5 Sep 2014

i made it but this answer is not clear ,,,, please try to show us just how we can add the initial values to run the simulink model without opening the command window and writing the values and then we run the simulink model
for example : i have this initial parameters : Pm=100e3; Flux=200; Ts=2e-5; p=2 ; N=2; f=50;
i need to make them inside of my simulink model without writing them in m-file or in command window
please help me


Sign in to comment.

Answer by karishma kousar on 1 Apr 2016

hello sir i have a matlab code for face detection but i dont know how to do the simulink blocks,please any one can help me in this designing a simulink model for my matlab code


Sign in to comment.