필터 지우기
필터 지우기

How do you read data from a Simulink.S​imulationD​ata.Datase​t object in MATLAB?

조회 수: 5 (최근 30일)
Denesh Reddy
Denesh Reddy 2022년 8월 30일
답변: Sanjana 2023년 9월 1일
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?

답변 (1개)

Sanjana
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

카테고리

Help CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by