How do you read data from a Simulink.SimulationData.Dataset object in MATLAB?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Sanjana
2023-9-1
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Genetic Algorithm 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!