How to load the simulink model(.slx) into dSpace Configuration desk by only using the matlab command(API Interface) ?
64 次查看(过去 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,
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1253192/image.png)
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.
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Create Large-Scale Model Components 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!