Check which field are the input from

1 Ansicht (letzte 30 Tage)
Harel Harel Shattenstein
Harel Harel Shattenstein am 19 Jul. 2015
Beantwortet: Walter Roberson am 19 Jul. 2015
Is there a way to check from which field the elements of the vector are? For example intger, rational numbers,etc. ?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 19 Jul. 2015
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.

Weitere Antworten (0)

Kategorien

Mehr zu Data Type Identification finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by