Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

rescale

Change scaling of fi object

Syntax

b = rescale(a, fractionlength)

b = rescale(a, slope, bias)
b = rescale(a, slopeadjustmentfactor, fixedexponent, bias)
b = rescale(a, ..., PropertyName, PropertyValue, ...)

Description

The rescale function acts similarly to the fi copy function with the following exceptions:

  • The fi copy constructor preserves the real-world value, while rescale preserves the stored integer value.

  • rescale does not allow the Signed and WordLength properties to be changed.

Examples

In the following example, fi object a is rescaled to create fi object b. The real-world values of a and b are different, while their stored integer values are the same:

p = fipref('FimathDisplay','none',...
		'NumericTypeDisplay','short');
a = fi(10,1,8,3) 

a =
 
    10
      s8,3
 
b = rescale(a,1) 

b =
 
    40
      s8,1
 
stored_integer_a = storedInteger(a);
stored_integer_b = storedInteger(b);
isequal(stored_integer_a, stored_integer_b)

ans =

1

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

See Also

Introduced before R2006a

Was this topic helpful?