Main Content

이 페이지는 기계 번역을 사용하여 번역되었습니다. 영어 원문을 보려면 여기를 클릭하십시오.

slmetric.metric.createNewMetricClass

네임스페이스: slmetric.metric

(제거 예정) 사용자 정의 모델 메트릭에 대한 새 메트릭 클래스 만들기

Metrics Dashboard 사용자 인터페이스, metricdashboard 기능, slmetric 패키지 API 및 해당 사용자 정의는 향후 릴리스에서 제거될 예정입니다. 자세한 내용은 Migrating from Metrics Dashboard to Model Maintainability Dashboard을 참조하세요.

설명

예제

slmetric.metric.createNewMetricClass(class_name)은 현재 작업 폴더에 slmetric.metric.Metric 클래스를 생성합니다. 새로운 메트릭 클래스는 사용자 정의 모델 메트릭을 정의하는 데 사용되며 다음 Advisor.component.Types을 지원합니다.

  • Model

  • SubSystem

  • ModelBlock

  • Chart

  • MATLABFunction

예제

모두 축소

이 예에서는 새 메트릭 클래스 my_metric를 생성하는 방법을 보여줍니다.

함수를 호출하고 새 메트릭 클래스의 이름을 제공합니다.

slmetric.metric.createNewMetricClass('my_metric')

이 함수는 현재 작업 폴더에 my_metric.m 파일을 생성합니다.

파일에는 생성자와 빈 메트릭 algorithm 메서드를 포함하는 my_metric에 대한 클래스 정의가 포함되어 있습니다.

classdef my_metric < slmetric.metric.Metric
    %my_metric Summary of this metric class goes here
    %   Detailed explanation goes here
    properties
    end
    
    methods
        function this = my_metric()
            this.ID = 'my_metric';
            this.ComponentScope = [Advisor.component.Types.Model, ...
                Advisor.component.Types.SubSystem];
            this.AggregationMode = slmetric.AggregationMode.Sum;
            this.CompileContext = 'None';
            this.Version = 1;
            this.SupportsResultDetails = false;
            
            %Textual information on the metric algorithm
            this.Name = '';
            this.Description = '';
            this.ValueName = '';
            this.AggregatedValueName = '';
            this.MeasuresNames = {};
            this.AggregatedMeasuresNames = {};
        end
        
        function res = algorithm(this, component)
            res = slmetric.metric.Result();	
            res.ComponentID = component.ID;
            res.MetricID = this.ID;
            res.Value = 0;
        end
    end
end

algorithm에 사용자 정의 메트릭 알고리즘을 작성하세요.

사용자 정의 메트릭 클래스가 작동하고 테스트되면 slmetric.metric.registerMetric을 사용하여 메트릭을 등록하십시오.

입력 인수

모두 축소

사용자 정의 지표에 대해 생성 중인 새 지표 클래스의 이름입니다.

데이터형: char

버전 내역

R2016a에 개발됨

모두 축소

R2022a: 경고

Metrics Dashboard 사용자 인터페이스, metricdashboard 기능, slmetric 패키지 API 및 해당 사용자 정의는 향후 릴리스에서 제거될 예정입니다. 자세한 내용은 Migrating from Metrics Dashboard to Model Maintainability Dashboard을 참조하세요.