Tunable IP Port for dsp.udpsender in generated code

1 view (last 30 days)
I have an application where I need to serve data over some number UDP ports (not known at compile time) and want to developed an exectuable to do so from coder. I would like to generate a single dsp.udpsender object and then change its remoteIPport property as I switch between each dataset. Something like this:
function [] = example(portnumbers)
mydata = [1, 2, 3, 4;...
5, 6, 7, 8];
udpSend = dsp.UDPSender('RemoteIPPort',portnumbers(i));
release(udpSend)
for i = 1:size(mydata,2)
udpSend.RemoteIPPort = portnumbers(i);
udpSend(mydata(i,:));
release(udpSend)
end
In the documentation for dsp.udpsender it seems like this should be possible, but I see a note in the Extended Capabilities Section onf C/C++ Code Generation that says, "The RemoteIPPort property is tunable in generated code but not tunable during simulation."
This note is unclear. Does this mean I can't have the property updated when the generated code is running? I don't know what it means to be tunable in generated code but not during simulation. If someone could explain this or provide a method to do what I am trying above I would appreciate it.
I have gotten around this in the past by just making a cell array of a large nunmber of udpsender objects and then calling them individually within the for loop, but this is extremely inefficient.
  1 Comment
Michael
Michael on 2 Jan 2023
FYI - I think the code above will work to switch the port numbers. I still don't understand what is meant by 'not tunable during simulation'. Does that just mean while the object is running - i.e. you need to use the 'release' command first?

Sign in to comment.

Answers (1)

Sarthak
Sarthak on 21 Apr 2023
Hi Michael,
As per my understanding, as mentioned in the documentation RemoteIPPort property is tunable in generated code and not tunable during simulation.
This means that if you are running a simulation of your MATLAB code that includes the "dsp.UDPSender" object, you cannot change the value of the "RemoteIPPort" property during simulation. This means that the IP port number of the remote host to which the UDP packets are sent will remain constant throughout the simulation and cannot be modified dynamically during simulation.

Categories

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

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!