フィルターのクリア

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 Center および File ExchangeGenetic Algorithm についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by