Main Content

이 번역 페이지는 최신 내용을 담고 있지 않습니다. 최신 내용을 영문으로 보려면 여기를 클릭하십시오.

join

클래스: matlab.unittest.diagnostics.Diagnostic
패키지: matlab.unittest.diagnostics

여러 개의 진단을 단일 배열로 연결

구문

diagArray = join(diag1,...,diagN)

설명

diagArray = join(diag1,...,diagN)diag1부터 diagN까지 지정된 여러 개의 진단을 단일 배열 diagArray로 연결합니다.

입력 인수

diag

진단 내용으로, Diagnostic 객체의 인스턴스, string형 배열, 문자형 배열, 함수 핸들 또는 임의의 유형으로 지정됩니다.

출력 인수

diagArray

연결된 진단 내용의 배열입니다.

  • diagNDiagnostic에서 파생되는 객체인 경우 수정되지 않은 배열에 포함됩니다.

  • diagNchar 또는 string인 경우 StringDiagnostic으로 구성되고 해당 배열에 포함됩니다.

  • diagNfunction_handle인 경우 FunctionHandleDiagnostic으로 구성되고 해당 배열에 포함됩니다.

  • diagN이 이 외의 유형인 경우 DisplayDiagnostic으로 구성되고 해당 배열에 포함됩니다.

예제

모두 확장

        % The following example creates a diagnostic array of length 4,
        % demonstrating standard Diagnostic conversions. Note:
        % MyCustomDiagnostic is for example purposes and is not executable
        % code.
 
        import matlab.unittest.diagnostics.Diagnostic
        import matlab.unittest.constraints.IsTrue
 
        arbitraryValue = 5;
        testCase.verifyThat(false, IsTrue, ...
            Diagnostic.join(...
                'should have been true', ...
                @() system('ps'), ...
                arbitraryValue, ...
                MyCustomDiagnostic))

대안

값 중 하나 이상이 진단인 경우 배열 결합(Concatenate)을 사용하여 진단을 배열로 연결할 수 있습니다. join 메서드가 있으면 배열에서 Diagnostics가 있을 필요가 없습니다. 다음 예제를 보겠습니다.

arbitraryValue = 5;
testCase.verifyThat(false, IsTrue, ...
    ['should have been true', ...
    @() system('ps'), ...
    arbitraryValue, ...
    MyCustomDiagnostic]);

MyCustomDiagnosticDiagnostic이므로 다른 값들도 올바르게 진단으로 변환됩니다.