Why do I receive 'Error using smimport_implementation' when using the 'smimport' function to import a CAD model into Simscape Multibody?

74 views (last 30 days)
Why do I receive 'Error using smimport_implementation' when using the 'smimport' function to import a CAD model into Simscape Multibody?
>> smimport('sm_robot');
Even when using the demo XML file, I get this error:
ERROR: Error using smimport_implementation
Workspace for block diagram 'sm_robot1' was not loaded because an error
occurred while loading the MATLAB-file
'C:Users\UserName's\Documents\MATLAB\sm_robot_DataFile1.m'.
Error in smimport (line 132)
[hModel, sDataFile] = smimport_implementation(xmlFile, varargin{ : });
Caused by:
Error using smimport_implementation
Error: Unexpected MATLAB expression.
A Simscape Multibody model still shows up, but when trying to run it, the following error appears in the diagnostic viewer: 
=== Simulation (Elapsed: 0.403 sec) === 
    Error:Error evaluating parameter 'PositionTargetValue' in 'sm_robot/Revolute' 
    Caused by: 
        Undefined variable "smiData" or class "smiData.RevoluteJoint". 
    Error:Error evaluating parameter 'PositionTargetValue' in 'sm_robot/Revolute1' 
    Caused by: 
        Undefined variable "smiData" or class "smiData.RevoluteJoint". 
    Error:Error evaluating parameter 'PositionTargetValue' in 'sm_robot/Revolute2' 
    Caused by: 
        Undefined variable "smiData" or class "smiData.RevoluteJoint". 
    Error:Error evaluating parameter 'PositionTargetRotationAngle' in 'sm_robot/Spherical' 
    Caused by: 
        Undefined variable "smiData" or class "smiData.SphericalJoint". 
    Error:Error evaluating parameter 'PositionTargetRotationArbitraryAxis' in 'sm_robot/Spherical' 
    Caused by: 
        Undefined variable "smiData" or class "smiData.SphericalJoint". 
    Error:Error evaluating parameter 'TranslationCartesianOffset' in 'sm_robot/Transform' 
    Caused by: 
        Undefined variable "smiData" or class "smiData.RigidTransform". 
    Error:Error evaluating parameter 'RotationAngle' in 'sm_robot/Transform' 
    Caused by: 
        Undefined variable "smiData" or class "smiData.RigidTransform". 
    Error:Error evaluating parameter 'RotationArbitraryAxis' in 'sm_robot/Transform' 
    Caused by: 
        Undefined variable "smiData" or class "smiData.RigidTransform". 
    Error:Error due to multiple causes. 
    Caused by: 
        Error evaluating parameter 'Mass' in 'sm_robot/base_1_RIGID/Solid' 
            Undefined variable "smiData" or class "smiData.Solid". 
        Error evaluating parameter 'CenterOfMass' in 'sm_robot/base_1_RIGID/Solid' 
            Undefined variable "smiData" or class "smiData.Solid". 
        Error evaluating parameter 'MomentsOfInertia' in 'sm_robot/base_1_RIGID/Solid' 
            Undefined variable "smiData" or class "smiData.Solid". 
        Error evaluating parameter 'ProductsOfInertia' in 'sm_robot/base_1_RIGID/Solid' 
            Undefined variable "smiData" or class "smiData.Solid". 
        Error evaluating parameter 'GraphicDiffuseColor' in 'sm_robot/base_1_RIGID/Solid' 
            Undefined variable "smiData" or class "smiData.Solid". 
        Error evaluating parameter 'GraphicOpacity' in 'sm_robot/base_1_RIGID/Solid' 
            Undefined variable "smiData" or class "smiData.Solid". 
    etc...

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 5 Jan 2023
Edited: MathWorks Support Team on 23 Jan 2023
This issue has been resolved as of MATLAB R2017b. 
For releases prior to MATLAB R2017b, Simulink encounters an issue when loading the MATLAB-file that contains the simulation data for the model. This issue arises when the path to the MATLAB-file contains an apostrophe.
There are a few workarounds:
1. Change the MATLAB Current Folder to a new directory that does not contain an apostrophe. It is best practice to avoid using spaces or any special characters in folder names used by MATLAB and Simulink.
2. In the generated model, navigate to the model's Model Workspace in the Model Explorer. Change the Workspace Data Source from MATLAB File to MATLAB Code. Copy the contents of the generated "sm_robot_DataFile.m" and paste it into the text area. Click Apply.
3. Upgrade to R2017b. This issue has been fixed in the newer release.
Additionally, please note that the error message referenced above:
ERROR: Error in smimport (line 132)
[hModel, sDataFile] = smimport_implementation(xmlFile, varargin{ : });
is not unique to this issue.  This error message is also common when the model being imported via 'smimport' is not formatted properly for MATLAB.  To this end, if you receive an error message similar to the one above for releases after MATLAB R2017b, it is most likely caused by an issue unrelated to this one.

More Answers (0)

Products


Release

R2016b

Community Treasure Hunt

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

Start Hunting!