0

I configured the data from Simulink to be saved as Structure with time on workspace, but I'm getting an error when I try to plot the variable.

plot(X.time, X.signals.values)

X is how I named the scope data. And this is the error I get

Error using plot
Data must be a single matrix Y or a list of pairs X,Y.

Is there some other configuration I should make on Simulink for this to work?

I have the 2017 version of Matlab

emic
  • 51
  • 8
  • 1
    To me it seems as though you are giving the plot function invalid inputs, the value of "X.time" and "X.signals.values" should be arrays of the same size. You can check both sizes by running "size(X.time)" and "size(X.signals.values)" to check their sizes before trying to plot them. – KillaKem Apr 22 '18 at 08:20
  • You also need to check the datatype of `X.signals.values`. Depending on how many signals you are saving, and how you are combining them into a signal, you may need to dig further into it before finding/extracting the numeric data itself. You might also want to try the `simplot` function instead. – Phil Goddard Apr 22 '18 at 14:59

0 Answers0