It looks like you are trying to declare a variable type. MATLAB does not have variable type declarations.
This is what your MATLAB code is actually doing:
int8 x
intmax("int8")
x=35
x=250
x=30000000000000000000
None of these commands have anything to do with each other. None of them have any effect on each other.
The first two lines assign their outputs to the default ans. The behavior of the first line is explained here:
Here are the two common ways in MATLAB of converting a value to a particular class, either specify the class:
or using indexing to assign to an existing array of that class:
>> x = zeros(1,1,'int8');
>> x(1) = 250
x = 127
Best Answer