Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Français - 日本語 - Русский
Ajuda do Scilab >> Funções de Compatibilidade > mtlb_uint8

mtlb_uint8

Matlab uint8 emulation function

Description

Matlab and Scilab uint8 behave differently :

  • Beyong the main interval bounds, Scilab's uint8() wraps, while Matlab's mtlb_uint8() saturates.
  • For non integer values, Scilab's uint8() truncates the fractional part, while Matlab's mtlb_uint8() rounds to the nearest integer.

xuint8(x)mtlb_uint8(x)
%nan00
-%inf00
-22540
-12550
000
222
10.21010
10.51011
10.511011
.........
255255255
2560255
2571255
%inf255255

mtlb_uint8 has not to be used for hand coded functions.

The function mtlb_uint8(A) is used by mfile2sci to replace uint8(A) when it is not possible to know what is the input while porting Matlab code to Scilab. This function then determines the correct semantic at run time.

Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Feb 14 15:01:10 CET 2019