'outdated' property of slmetric.metric.ResultCollection not showing true even though model is changed
3 次查看(过去 30 天)
显示 更早的评论
I want to execute the model metric programmatically only if there is change in the model. I am using 'outdated' property of slmetric.metric.ResultCollection to read the information.As per documentation ,outdated property of slmetric.metric.ResultCollection returns true if there is a model change. But its not happening.
I am follwing the below sequence of operation.
- metric_engine = slmetric.Engine();
- setAnalysisRoot(metric_engine,'Root',<model_name>,'RootType', 'Model');
- execute(metric_engine)
2)did some modification in the model manullly(removed some blocks)
3)res_col = getMetrics(metric_engine, 'mathworks.metrics.SimulinkBlockCount');
my expectation is res_col.Outdated should return true as there are model changes after the metrics execution.But its returining false always
Please let me know how to execute the model metric programmatically only if there is change in the mode?
0 个评论
回答(1 个)
Aneela
2024-10-10
Hi Abina Ansary,
You should call “execute” after any changes to a metric to ensure that the status of “outdated” property is updated for previously collected metrics.
Refer to the below example:
metric_engine = slmetric.Engine();
setAnalysisRoot(metric_engine,'Root','MySimpleModel','RootType', 'Model');
execute(metric_engine, 'mathworks.metrics.SimulinkBlockCount')
res_col = getMetrics(metric_engine, 'mathworks.metrics.SimulinkBlockCount');
res_col.Outdated ;
% modify the model and save
execute(metric_engine, 'mathworks.metrics.FileCount');
%get block count results and see Outdated == true
res_col = getMetrics(metric_engine, 'mathworks.metrics.SimulinkBlockCount');
res_col.Outdated ;
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Model Metrics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!