Is it possible to set up the Simulation Data Inspector to use the physical units set in Simscape blocks in R2020a?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 15 de Jul. de 2020
Respondida: MathWorks Support Team
el 15 de Jul. de 2020
Is it possible to set up the Simulation Data Inspector to use the physical units set in Simscape blocks in R2020a?
Respuesta aceptada
MathWorks Support Team
el 15 de Jul. de 2020
Right now it is not automatically possible and our development team considers this for a future release.
In the meantime the Simulation Data Inspector API can be used to automate it.
There for see the following example code, where the most recent run gets looped through and all signals with 'Pa' unit and 'm^3/s' unit are automatically changed to 'bar' and 'L/min':
% Get run IDs for most recent run
allIDs = Simulink.sdi.getAllRunIDs;
runID = allIDs(end);
% Get Run object
run = Simulink.sdi.getRun(runID);
% Change property for all signals in the latest run
for i = 1:run.SignalCount
% Get signal IDs
sigID = run.getSignalIDByIndex(i);
if (run.isValidSignalID(sigID))
% Get signal
sig = Simulink.sdi.getSignal(sigID);
% Change signal units
if strcmp(sig.Units,'Pa')
sig.convertUnits('bar');
end
if strcmp(sig.Units,'m^3/s')
sig.convertUnits('L/min');
end
end
end
Here you can find more details about the API:
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre View and Analyze Simulation Results en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!