How do you read data from a Simulink.SimulationData.Dataset object in MATLAB?
2 views (last 30 days)
Show older comments
I'm running a Simulation outputting the Simulink.SimulationData.Dataset object z and I want to run a genetic algorithm in MATLAB. So I need to read the data in z, if I use this code in the command window:
getElement(z,'').Values.Data(end)
it reads the last value in z, so the data is in the Workspace. However, when running the script to execute the genetic algorithm, it gives the error:
Check for incorrect argument data type or missing argument in call to function 'getElement'.
Error in RunOptimisation>volumeThroughput (line 101)
outData = getElement(z,'').Values.Data(end);
Can you help with why it can't read z from the script?
0 Comments
Answers (1)
Sanjana
on 1 Sep 2023
Hi Denesh,
I understand that you are facing an issue with reading data from “Simulink.SimulationData.Dataset” object.
As per the documentation, the “getElement” function requires two arguments, the “Signal Object” and the “name” of the Signal to be accessed. Passing an empty character vector as input is invalid, therefore replace the empty character vector with the required signal “name”.
Please refer to the following link, for further information,
Hope this helps!
Regards,
Sanjana
0 Comments
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!