how to generate MATLAB code from Simulink model

Hi, I have a relatively complex simulink model, from which a MATLAB code must be generated. I want to use the generated code in App designer to develop an app and finally compile the app using `Application Compiler`, so that it can be used on every system without having MATLAB installed. The process can be summed up as the following: Simulink --> MATLAB code (.m) --> App Designer --> Application compiler (.exe)

7 comentarios

Kevin Chng
Kevin Chng el 26 de Oct. de 2018
Editada: Kevin Chng el 26 de Oct. de 2018
How about direct use sim() to run your model in your App Designer script?
You can do what Kevin suggested and then generate the executable file. Are you facing any issues in doing so?
Keymand Kiani
Keymand Kiani el 30 de Oct. de 2018
Unfortunately it doesn't work that way; because it must be a stand-alone executable data at the end. as far as MATLAB is instaled and opened it is no problem. The solution that I've found so far is to convert the simulink model to c/c++ code and using mex function to recall it in the MATLAB script. But it doesn't seem to be easy and you have to modify the c++ code that is generated from simulink model! well you must have deep knowledge in c/c++ and MATLAB to handle it.
Kevin Chng
Kevin Chng el 31 de Oct. de 2018
you generate MATLAB Code from Simulink?
Amare
Amare el 29 de Jun. de 2024
Editada: Walter Roberson el 30 de Jun. de 2024
: Begin by implementing a convolutional encoder
in Simulink. The convolutional encoder takes the input message bits
and produces a stream of encoded bits. The encoder consists of shift
registers and exclusive-OR (XOR) gates.
Amare
Amare el 29 de Jun. de 2024
give mathalba code for abouv question
  1. That looks like a Doit4Me
  2. It is confusing whether the work is to be done in Simulink or in MATLAB

Iniciar sesión para comentar.

Respuestas (5)

Eric Sargent
Eric Sargent el 9 de Dic. de 2020
Editada: Eric Sargent el 9 de Dic. de 2020

1 voto

As of R2020a you can use Simulink Compiler to compile your model and use it with your deployed / compiled App Designer app.
More information about Simulink Compiler can be found here:
Walter Roberson
Walter Roberson el 31 de Oct. de 2018
Editada: Walter Roberson el 30 de Jun. de 2024

0 votos

There is no support for what you are doing.
You can use Simulink Real Time Explorer, using instrument panels for user interaction.

2 comentarios

Amare
Amare el 5 de Jul. de 2024
cheak it refuse to run
It sounds like you do not have Simulink Real Time Explorer installed.

Iniciar sesión para comentar.

puli
puli el 5 de Oct. de 2022
Editada: Walter Roberson el 5 de Oct. de 2022
image = imread('jump.jpg'); % read image
Error using imread>get_full_filename
File "jump.jpg" does not exist.

Error in imread (line 372)
fullname = get_full_filename(filename);
% get image dimensions: an RGB image has three planes
% reshaping puts the RGB layers next to each other generating
% a two dimensional grayscale image
[height, width, planes] = size(image);
rgb = reshape(image, height, width * planes);
imagesc(rgb); % visualize RGB planes
colorbar on % display colorbar
r = image(:, :, 1); % red channel
g = image(:, :, 2); % green channel
b = image(:, :, 3); % blue channel
The result is:
EDMOND
EDMOND el 22 de Jul. de 2023

0 votos

How to convert binary code to gray code in matlab

1 comentario

https://www.mathworks.com/help/comm/ug/symbol-mapping-examples.html shows how to use comm.PSKModulator for gray code.
For standaline functions to convert to gray code, check the File Exchange; there are several there.

Iniciar sesión para comentar.

sandeepnaik
sandeepnaik el 2 de Abr. de 2025

0 votos

samrt and sustainable agriculture

1 comentario

Please expand on your answer. I do not understand how this answer solves problems with compiling Simulink code.

Iniciar sesión para comentar.

Categorías

Más información sobre Simulink Coder en Centro de ayuda y File Exchange.

Preguntada:

el 26 de Oct. de 2018

Comentada:

el 2 de Abr. de 2025

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by