I want to program an arduino using matlab by "arduino support package" and I want to use simulink in normal input output operations but also use Matlab language in another part so is it possible to make a code consist of simulink model and matlab language and add this code to arduino ? and if it possible how to make it ?
2 Answers
You can use from simulink library browser under User-defined functions figure out which one is suitable for your system.
If you get some delay while calling Matlab function than you can also use a sybsytem as matlab function because matlab function gives output in delay in terms of calling function and returning the value but if you generate the same function im simulink model then output will be without delayed version as shown in the figure
-
1$\begingroup$ Welcome to Robotics Krunal Vaghani, but on Stack Exchange we are are looking for comprehensive answers that provide some explanation and context. Very short answers cannot do this, so you may want to edit your answer to explain why it is right, ideally with citations. Answers which don't include explanations may be removed if brought to a moderators attention. $\endgroup$ Commented Oct 17, 2016 at 15:57
-
$\begingroup$ @MarkBooth thank you for suggestion. I will try my best to explain the answer. $\endgroup$– Krunal VCommented Nov 1, 2016 at 10:50
You can run a reduced version of the matlab language in Simulink using the Matlab function block, but I doubt this includes arduino commands.
You can extend this reduced version of the Matlab language by declaring the external functions which you would like to use, with the coder.extrinsic command. here is a tutorial on how to do this.