Borrar filtros
Borrar filtros

How can I use geoplot function in Simulink?

10 visualizaciones (últimos 30 días)
reza
reza el 19 de Abr. de 2023
Comentada: Francesco Ciocca el 22 de Mayo de 2023
Hello everyone,
I have a simulink model and also an m-file including geoplot function.
I am trying to run the simulink model and m-file at the same time like using matlab function block but it is not possible beacause of the geoplot function.
Do you think is there another way?

Respuesta aceptada

Suraj
Suraj el 24 de Abr. de 2023
Hello Reza
I understand that you would like to run a script, that uses “geoplot”, from your Simulink model. If you have tried achieving this using “MATLAB Function” block it should produce an error. This is because “MATLAB Function” block checks for errors that might occur during codegen, and “geoplot” is not supported for code generation. Here is the supporting documentation for this error - https://www.mathworks.com/help/coder/ug/function-is-not-supported-for-code-generation.html
However, if you bypass the code-generation step and instead use the MATLAB engine for execution, the script should run as expected. For this you need to declare your function as “extrinsic”.
Below is a template you can follow for the code in the MATLAB function block. Assume that your script is saved as “myPlotFcn.m”
function fcn()
coder.extrinsic('myPlotFcn')
myPlotFcn()
  1 comentario
Francesco Ciocca
Francesco Ciocca el 22 de Mayo de 2023
Hi @Suraj,
really thank you for your answer, I found it while searching for a simular issue.
I wanted to implement geoplot in Simulink, but I've understood that it is not possible. What I'm trying to achieve is something like: when I run the Simulink model, somehow a figure appears that represents the geoplot of something.
So, as you suggested, I've written a script on Matlab with inside the geoplot function and therefore I tryed to recall the .m script inside a MatlabFunctionBlock inside Simulink.
The problem is that Simulink presents an error "This text contains non-empty top-level expressions. It appears to be a script."
Would you kindly have any suggestion to solve this problem?
Thank you very much for the patience.
Francesco

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by