Using fwrite in MATLAB to graph constant double values in Simulink Scope blocks?

1 view (last 30 days)
I am currently trying to use UDP to send constant values from MATLAB to Simulink and then use Simulink to graph these values. Here is an image of the MATLAB code, Simulink block diagram and the graph that I am working with (note that the graph starts at a constant value of 0):
In the MATLAB code I am using the fwrite function to send data to the Packet Input block which then outputs to the Scope block to graph the data. Specifically I would like to graph fractions and that is why I chose to use type double. When I run the MATLAB code the graph should jump from 0 to 50.5 as it is running in real time. However, it stays at 0.
I think there may be some problems with settings I used for the Packet Input Simulink block. Here are the settings:
I have tried this with type int8 and the graph changes according to what I input in the fwrite function. As you can see in the following image I graphed the value 50 using fwrite in int8:
Here, I made changes to the "Input Packet size" and "Block output data types" since I am using int8 as shown in this image:
If anyone knows what the problem is please let me know, thanks!

Answers (1)

Justin Liang
Justin Liang on 1 Jun 2013
Does anyone know how to do this?

Community Treasure Hunt

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

Start Hunting!