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!