Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.1 - Português

Change language to:
English - Français - 日本語 - Русский

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Ajuda do Scilab >> Scilab > Scilab palavra-chave > minus

minus

(-) operador de subtração, mudança de sinal

Seqüência de Chamamento

X-Y
-Y

Parâmetros

X

escalar, vetor ou matriz de números, polinômios ou razões de polinômios. Também pode ser uma lista syslin

Y

escalar, vetor ou matriz de números, polinômios ou razões de polinômios. Também pode ser uma lista syslin

Descrição

Subtração

Para operandos numéricos, é a operação de subtração em seu sentido usual. Se um dos operandos é uma matriz e o outro um escalar, a operção é realizada elemento a elemento.

As soon as a boolean is involved in a substraction with a number (decimal, complex, or encoded integer), it is automatically converted in the type (and integer type) of the number before performing the substraction or the sign change, as %F => 0 and %T => 1.

Qualquer que seja o tipo (regular) de X, então []-X, X-[] e -[] produzem [].

O operador de subtração pode ser estendido para outros tipos de dados personalizados através do mecanismo overloading.

Exemplos

[] - 2
1 - []
[2, 5] - 1
[2, 5] - [3 -2]

%s - 2
1/%s - 2
--> [] - 2
 ans  =
    []

--> 1 - []
 ans  =
    []

--> [2, 5] - 1
 ans  =
   1.   4.

--> [2, 5] - [3 -2]
 ans  =
  -1.   7.

--> %s - 2
 ans  =
  -2 +s

--> 1/%s - 2
 ans  =
   1 - 2s
   -------
     s

Com booleanos :

-[%f %t]
[%f %f %t %t]  - [%f %t %f %t]
%t - %i
c = %t - int8(7), inttype(c)
--> -[%f %t]
 ans  =
   0.  -1.

--> [%f %f %t %t]  - [%f %t %f %t]
 ans  =
   0.  -1.   1.   0.

--> %t - %i
 ans  =
   1. - i

--> c = %t - int8(7), typeof(c)
 c  =
 -6

 ans  =
 int8

Ver Também

  • plus — Adição numérica. Concatenação de texto (colagem)
  • operators — nomes dos operadores Scilab
  • overloading — capacidades de overloading ("sobrecarga") de exibições, funções e operadores
  • oldEmptyBehaviour — Controls the operation+ and operation- behaviour for Scilab
  • mtlb_s — Matlab subtraction emulation function

Histórico

VersãoDescrição
6.0.0 A - [] and [] - A now return [] instead of A or -A.
Report an issue
<< less Scilab palavra-chave not >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Jan 03 14:35:18 CET 2022