Check which field are the input from

조회 수: 1 (최근 30일)
Harel Harel Shattenstein
Harel Harel Shattenstein 2015년 7월 19일
답변: Walter Roberson 2015년 7월 19일
Is there a way to check from which field the elements of the vector are? For example intger, rational numbers,etc. ?

채택된 답변

Walter Roberson
Walter Roberson 2015년 7월 19일
isinteger() for the int* and uint* classes
isfloat() for the single and double classes
class() to determine the exact class
isa() to test membership in a particular class
If you have a floating point number and you wish to know whether it is an integer, test whether mod(Number,1) is 0.
If you have a floating point number and you wish to know whether it is rational, then the answer is Yes it is (unless it is infinite or nan), as all floating point numbers are represented as rational fractions of powers of 2.
If your question has to do with the Symbolic Toolbox then the answers are different.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Identification에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by