How to load the simulink model(.slx) into dSpace Configuration desk by only using the matlab command(API Interface) ?

45 ビュー (過去 30 日間)
I want to do the dSpace Configuration Desk Automation by using the Matlab .m script.
For this I have opened the Configuration Desk application using Matlab command. But, now I want to add one Simulink model i.e. 'Model.slx' into the application i.e. 'Demo'.
For this I need to use the method Configure() as given command.
CFD.ActCFD.ActiveApplication.Components.ModelTopology.Configure('AddModel'...)
For above command I have the information which is as below,
Here as a second command, I need to give the parameter Array into Configure('AddModel',Parameter_Array)
I have made the parameter array as below,
Array_Model = ["C:\Projects\Project1\Model.slx" "false" " " "true"]
and when I am giving the command as below, I am getting the respective error.
CFD.ActCFD.ActiveApplication.Components.ModelTopology.Configure('AddModel',Array_Model)
Error is as below,
Warning: ActiveX - invalid argument type or value
Error using
Interface.fb8245f9bcefcf70a40e486497c2b0f0426c2b60_ICaComponent/Configure
Invoke Error, Dispatch Exception:
Source: ConfigurationDeskAutomationCore
Description: AutomationError
Import file failed for ModelTopology: Wrong file path
; HResult;
So, if anyone has any Idea about this Please help me.

採用された回答

Sarthak
Sarthak 2023 年 3 月 21 日
Hi Shiv,
From my understanding, the error message you provided suggests that the Configure methos is not able to find the file path for the Simulink model. I would suggest you double-check the file path and make sure that it exists and is accessible. You can also the fullfile function to get the full path in MATLAB.
Once you have the correct file path, I would also suggest you to mention the parameter names in the parameter array
% Get the ModelTopology component
ModelTopology = CFD.ActCFD.ActiveApplication.Components.ModelTopology;
% Specify the parameters for loading the Simulink model
parameterArray = {'ModelFilePath', 'C:\path\to\model.slx', ...
'ModelName', 'MyModel', ...
'ForceReload', true, ...
'Activate', false};
% Load the Simulink model into Configuration Desk
ModelTopology.Configure('AddModel', parameterArray);
This should add the Simulink model to the Configuration Desk application. If you still encounter an error, check the dSpace Configuration Desk Automation documentation for further information.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Coder についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by