I'm using Embedded Coder. Is there a way to configure the code generation process so that the dimensions of an input signal can be set at run time?

4 views (last 30 days)
The general workflow here is to use variable size signals from a selector where the upper bound of the variable size signal is explicity set.
However, I'm autogenerating a signal representing an image (960x1280) in an application where memory management is critical. The selected signal is very often only a small subset of the maximum signal size and only needs to be set prior to initialization. A variable sized signal would result in the upper bound 960x1280 signal being propogated through my model. Where as, what I would call a configurable run-time parameter could allocate just the memory that is required at initialization. The work flow would then be as follows, If the image size selection is changed then the code would be terminated and re-initialized with the new dimensions. Is there a way to setup the code generation process to support this workflow?
I will also point out that dynamic memory application is not an acceptable solution for our application.

Answers (1)

Nick Sarnie
Nick Sarnie on 17 Nov 2018
Edited: Nick Sarnie on 17 Nov 2018
Hi David,
Variable size signals are meant for signals that will change size during the execution of the model. It sounds like the size of your signals will be constant once the model starts, but will change betweens runs of the model.
You may want to investigate into Symbolic Dimensions. You can find an example below:
Thanks,
Nick
  1 Comment
David Grosher
David Grosher on 19 Nov 2018
Yes, I had already started looking at Symbolic Dimensions and I had worked through that demonstration. The major issue though is that there are very few blocks that support this feature. Matlab functions for example only work in for loops where data is explicitely accessed. As I mentioned, I'm using an image, meaning that each element of the matrix is related to the elements near it, It does not seem obvious to me how to access the full matrix for use inside of matlab functions or with the computer vision toolbox. I don't see how this feature wouldn't require an almost complete rewrite of all of that code.

Sign in to comment.

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!