# removefimath

Remove fimath object from `fi` object

## Syntax

``y = removefimath(x)``

## Description

example

````y = removefimath(x)` returns a `fi` object `y` with `x`’s `numerictype` and value, and no fimath object attached. You can use this function as ```y = removefimath(y)```, which gives you localized control over the fimath settings. This function also is useful for preventing errors about `embedded.fimath` of both operands needing to be equal.```

## Examples

collapse all

This example shows how to define a `fi` object, define a fimath object, attach the `fimath` object to the `fi` object and then, remove the attached `fimath` object.

`a = fi(pi)`
```a = 3.1416 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 16 FractionLength: 13 ```
```f = fimath('RoundingMethod','Floor','OverflowAction','Wrap'); a = setfimath(a,f)```
```a = 3.1416 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 16 FractionLength: 13 RoundingMethod: Floor OverflowAction: Wrap ProductMode: FullPrecision SumMode: FullPrecision ```
`b = removefimath(a)`
```b = 3.1416 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 16 FractionLength: 13 ```

Use the pattern `x = setfimath(x,f)` and ```y = removefimath(y)``` to insulate variables from `fimath` settings outside the function. This pattern does not create copies of the data in generated code.

```function y = fixed_point_32bit_KeepLSB_plus_example(a,b) f = fimath('OverflowAction','Wrap',... 'RoundingMethod','Floor',... 'SumMode','KeepLSB',... 'SumWordLength',32); a = setfimath(a,f); b = setfimath(b,f); y = a + b; y = removefimath(y); end ```

If you have the MATLAB® Coder™ product, you can generate C code. This example generates C code on a computer with 32-bit, native integer type.

```a = fi(0,1,16,15); b = fi(0,1,16,15); codegen -config:lib fixed_point_32bit_KeepLSB_plus_example... -args {a,b} -launchreport ```
```int fixed_point_32bit_KeepLSB_plus_example(short a, short b) { return a + b; }```

## Input Arguments

collapse all

Input data, specified as a `fi` object or built-in integer, from which to copy the data type and value to the output. `x` must be a `fi` object or an integer data type (`int8`, `int16`, `int32`, `int64`, `uint8`, `uint16`, `uint32`, or `uint64`). If `x` is not a fi object or integer data type, then `y` = `x`.

## Output Arguments

collapse all

Output fi object, returned as a `fi` object with no fimath object attached. The data type and value of the output match the input. If the input, `x`, is not a `fi` object `y` = `x`.

## Version History

Introduced in R2012b