How to Convert files from MDL to SLX in a Project - En-Akhidma24

How to Convert files from MDL to SLX in a Project



Convert from MDL to SLX in a Project




1. In the models folder for example, check if this project contains models saved in MDl format.



2. Create a Blank Project: (New =>Blank Project)




3. Click on the set up Project button: (Next => finish)



4. The following window is displayed



5. Entering the folowing code in command window of matlab and click Enter:

project = currentProject;
allProjectFiles = project.Files;
for fileIndex = 1:numel(allProjectFiles)
    projectFile = allProjectFiles(fileIndex);    
    [folder, name, ext] = fileparts(projectFile.Path);
    if strcmp(ext, '.mdl')
        % This is a MDL file. Load it and then save as an SLX file.       
        mdlModel = fullfile(folder, [name + ext]);
        slxModel = fullfile(folder, [name + '.slx']);
        load_system(mdlModel);
        % Save a new copy of this file in SLX format:
        save_system(name, slxModel);
        close_system(name,0);
    end
end



6. Click on the Run Checks button:









8. Project checks rerun after you click Yes to perform the fix. Close the Project Integrity Checks dialog box


9. Verify Changes After Upgrade to SLX

Click the Modified files view of the project. Project checks added the newly created SLX files to the projectand scheduled the original MDL files for removal.


Aucun commentaire :