matlab.unittest.constraints.IsScalar 클래스
패키지: matlab.unittest.constraints
슈퍼클래스: matlab.unittest.constraints.BooleanConstraint
스칼라 값을 지정하는 제약 조건
생성
IsScalar
는 스칼라 값을 지정하는 제약 조건을 제공합니다. 이 제약 조건은 실제 값이 스칼라인 경우 충족됩니다.
복사 의미 체계
값입니다. 값 클래스가 복사 작업에 미치는 영향에 대한 내용은 객체 복사 항목을 참조하십시오.
예제
실제 값이 스칼라인지 테스트
대화형 방식 테스트를 위한 테스트 케이스를 생성합니다.
import matlab.unittest.TestCase import matlab.unittest.constraints.IsScalar testCase = TestCase.forInteractiveUse;
값 0이 IsScalar
제약 조건을 충족하는지 확인합니다.
testCase.verifyThat(0,IsScalar)
Interactive verification passed.
단일 객체가 스칼라인지 어설션합니다.
testCase.assertThat(timeseries(1),IsScalar)
Interactive verification passed.
벡터가 스칼라가 아님을 확인합니다.
testCase.verifyThat([2 3],IsScalar)
Interactive verification failed. --------------------- Framework Diagnostic: --------------------- IsScalar failed. --> The value must be a scalar. --> The value has a size of [1 2]. Actual Value: 2 3
빈 구조체가 IsScalar
제약 조건을 충족하지 않는지 어설션합니다.
testCase.assertThat(struct([]),IsScalar)
Interactive assertion failed. --------------------- Framework Diagnostic: --------------------- IsScalar failed. --> The value must be a scalar. --> The value has a size of [0 0]. Actual Value: 0x0 struct array with no fields. Assertion failed.
버전 내역
참고 항목
HasElementCount
| HasLength
| HasSize
| IsEmpty
| isscalar
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)