reinterpretcast
기본 데이터를 변경하지 않고 고정소수점 또는 정수 데이터형 변환
설명
예제
fi
객체를 새 데이터형으로 변환하기
이 예제에서 a
는 워드 길이가 8비트이고 소수부 길이가 7비트인 부호 있는 fi
객체입니다. reinterpretcast
함수는 a
를 워드 길이가 8비트이고 소수부 길이가 0비트인 부호 없는 fi
객체 c
로 변환합니다. a
와 c
의 실제 값은 다르지만 이진수 표현은 동일합니다.
a = fi([-1 pi/4],1,8,7)
a = -1.0000 0.7891 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 8 FractionLength: 7
T = numerictype(0,8,0); c = reinterpretcast(a,T)
c = 128 101 DataTypeMode: Fixed-point: binary point scaling Signedness: Unsigned WordLength: 8 FractionLength: 0
기본 데이터가 변경되지 않았는지 확인하려면 a
와 c
의 이진수 표현을 비교합니다.
binary_a = bin(a)
binary_a = '10000000 01100101'
binary_c = bin(c)
binary_c = '10000000 01100101'
입력 인수
a
— 입력 고정소수점 또는 정수형 배열
스칼라 | 벡터 | 행렬 | 다차원 배열
입력 고정소수점 또는 정수형 배열로, 스칼라, 벡터, 행렬 또는 다차원 배열로 지정됩니다.
입력값 a
와 T
의 워드 길이는 동일해야 합니다.
데이터형: int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| fi
복소수 지원 여부: 예
T
— 새 데이터형
numerictype
객체
새 데이터형으로, 고정소수점 데이터형을 완전히 지정한 numerictype
객체로 지정됩니다.
입력값 a
와 T
의 워드 길이는 동일해야 합니다.
확장 기능
C/C++ 코드 생성
MATLAB® Coder™를 사용하여 C 코드나 C++ 코드를 생성할 수 있습니다.
HDL 코드 생성
HDL Coder™를 사용하여 FPGA 및 ASIC 설계를 위한 VHDL, Verilog 및 SystemVerilog 코드를 생성할 수 있습니다.
버전 내역
R2008b에 개발됨
참고 항목
cast
| fi
| numerictype
| typecast
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)