How can I load a preferences view (with Simulink.sdi.loadView) in simuation data inspector only with .mat file ?

Hi community,
I am trying to load .mat files for debug using Simulation Data Inspector, and sometimes I need to check the same signals for differents .mat files, For that I found a way that may help me, which is Simulink.sdi.loadView('savedView.mldatx'), but its dones not work as expected for me (using Matlab 2020b).
here's a steps:
1-In a folder a have a .mat file, and I put the main matlab path in that folder Path.
in Command windows put the below commands
2-Simulink.sdi.view
3-runID = Simulink.sdi.createRun('Name of mat file','file','file.mat');
after having the .mat loaded, I can setup my signals preferences and plot layout, then I save it with:
4-Simulink.sdi.saveView('saveAview') %here I save the view that I need to load each time
Now the steps to load the saved preferences.
5-Simulink.sdi.clear
6-runID = Simulink.sdi.createRun('Name of mat file','file','file.mat'); %load again my .mat file
4-Simulink.sdi.loadView('savedView.mldatx'); %load my saved preferences.
But it only loading the plot layout dimension (ie, 3x3) and not the signals within the plots.
can you please help if you have the same problem doing the same steps ?
Thanks in advance for your help

 Accepted Answer

I think the problem is that the name of the saved view doesn't match the name of the view you are loading. What happens if you use Simulink.sdi.loadView('saveAview.mldatx') instead? Here's a little code template similar to yours that worked for me:
Simulink.sdi.view
runID1 = Simulink.sdi.createRun('run1','file','file1.mat');
Simulink.sdi.saveView('saveAview')
Simulink.sdi.clear
runID2 = Simulink.sdi.createRun('run2','file','file2.mat');
Simulink.sdi.loadView('saveAview.mldatx');

More Answers (0)

Products

Release

R2020b

Asked:

on 18 Mar 2022

Commented:

on 2 Feb 2023

Community Treasure Hunt

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

Start Hunting!