Simulink Data Inspector missing data in plots
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi
My simulink data inspector seems to not be plotting all the data from the simulation. Below it can be seen data points are only shown from time of 9ms to 10ms. There are supposed to be three simulation data results being plot from time 0 to 10ms, which were acquired in parallel.

However, if I tap into the data manually to plot the results from the simulation myself using the code as follows:
>> b = simOut(1).tout;
>> c = simOut(1).VoltageOut.signals.values;
>> d = b(1:length(c));
>> plot(d,c)
The above code results in the response as follows:

So I can only assume I have all the data in my 'simOut' variable, but the data inspector is not seeing it, or there is a setting somwhere which I am not seeing? I've looked at the 'logging intervals' and 'output options' but can't find the solution.
I've also tried to extract the data to just plot all three to the same figure but I wanted to do this programmatically somehow using indexing, but I couldn't get that to work either! Here is the code where I just tried to expand on. It's just the above with some index, but it doesn't work due to the fact I don't know how to correct access the index/array.
for idx = 1:numSims
b(idx) = simOut(idx).tout;
c(idx) = simOut(idx).VoltageOut.signals.values;
d(idx) = b((idx)(1:length(c(idx)));
end
The above gives me an error for the line where d(idx) is assigned "Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.". I've thrown a few curly brackets in there but it didn't help as I don't know this topic too well.
Any help to fix either, or both, of these two would be appreciated.
Thank you.
3 Kommentare
Brian
am 21 Nov. 2024
Yes!!!! I rerun my scripts to create multiple plots and sometimes half are cut off and other times the data isn't correct. Much of the time I shut everything down and restart. I haven't found anything online to help with this.
Altaïr
am 13 Feb. 2025
I would suggest creating a separate detailed query along with your model in case the issues still persist.
Antworten (1)
Altaïr
am 13 Feb. 2025
The issue seems to be related to the Limit data points to last option available in various locations within Simulink. This option restricts the number of data points to the most recent ones, and its effect depends on where it is configured. Here are some places where this option can be found, along with commands to open the corresponding documentation in R2020a:
1. Data Import/Export tab in Configuration Parameters dialog box. This setting limits the number of data points logged for outputs and states. Note that the To Workspace, Scope block, and Signal logging options do not adhere to this setting.
web(fullfile(docroot, 'simulink/gui/limit-data-points.html'))
2. Block Parameter of To Workspace block. This limits the number of data points logged by the To Workspace block.
web(fullfile(docroot, 'simulink/slref/toworkspace.html#bs_p06g'))
3. Logging tab in the Configuration Parameters of the Scope block. This limits the number of data points logged by the Scope block.
web(fullfile(docroot, 'simulink/slref/scope.html#d120e184005'))
4. Simulink Signal Logging Selector window which can be accessed after enabling Signal logging under Data Import/Export tab in Configuration Parameters. Alternatively the Signal Properties dialogure can be used. This limits the number of data points logged for that particular signal.
web(fullfile(docroot, 'simulink/ug/configuring-a-signal-for-signal-logging.html'))
Additionally, the Record logged workspace data in Simulation Data Inspector option under the Data Import/Export tab can include logged workspace variables in the Data Inspector. More information on logging signals can be found here:
As the exact source of the issue cannot be determined without the model, a quick check would be to ensure that the Limit data points to last option is either disabled or set to inf in all such possible places.
Regarding the second part of the question on plotting the logged data, if a To Workspace block is used to output signals as timeseries data, the following line of code can be used to plot the signals in a single figure:
plot(simout.Time, simout.Data)
For more details about the To Workspace block, the documentation can be accessed with:
web(fullfile(docroot, 'simulink/slref/toworkspace.html'))
0 Kommentare
Siehe auch
Kategorien
Mehr zu Save Run-Time Data from Simulation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!