- Open the Scope block in your Simulink model.
- In the toolbar, go to View > Configuration Properties > Logging.
- Ensure the "Log data to workspace" option is checked.
- Assign a variable name, such as “ScopeData”, and select your preferred save format (e.g., "Array") from the dropdown menu.
- Save the changes by clicking "OK".
Saving Scope Data in Simulink
51 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello everyone,
I am working on a project where I have to save data of scope. I am using the code shown below but its not working for me as I want to save the data after every iteration and the scope have multiple variables attached. How can I do that?
for i =1:numel(All_IR)
IR=All_IR(i)
simOut=sim('ModelName')
Loggings(i).scopeData=scopeData
end
0 Kommentare
Antworten (1)
Shlok
am 21 Aug. 2024
Hi,
I understand that you want to save the scope data using the above given code. However, you need to address the following things to achieve the same:
1) Check if you have enabled Scope logging.
2) Ensure the “SaveOutput” parameter in the “sim” function is set to "on". By default, it is "on," but if it has been disabled, you should explicitly set it as shown below:
sim('ModelName', 'SaveOutput', 'on');
3) In your code, you’re trying to access “scopeData” directly. Instead, you should extract it from the output of the “sim” function (eg: “simOut”, here), as it is stored there as a field.
Here is the modified code:
for i = 1:numel(All_IR)
IR = All_IR(i);
simOut = sim('ModelName', 'SaveOutput', 'on');
% Assuming the scope data is logged in "ScopeData" variable set using Configuration Properties panel
Loggings(i).scopeData = simOut.ScopeData;
end
For more information related to logging, you can check out the following documentation link:
Hope it helps.
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!