问题
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):
http://i.imgur.com/krkulyQ.png
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:
http://i.imgur.com/Chc0qk8.png
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:
http://i.imgur.com/Xzytfka.png
Here, I made changes to the "Input Packet size" and "Block output data types" since I am using int8 as shown in this image:
http://i.imgur.com/DUJ4eKB.png
If anyone knows what the problem is please let me know, thanks!
来源:https://stackoverflow.com/questions/16754867/using-fwrite-in-matlab-to-graph-constant-double-values-in-simulink-scope-blocks