Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.0 - English

Change language to:
Français - 日本語 - Português

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

Scilab manual >> Matlab to Scilab Conversion Tips > Matlab-Scilab equivalents > M > max (Matlab function)

max (Matlab function)

Maximum

Matlab/Scilab equivalent

Matlab Scilab

Particular cases

Matlab max function can work with complexes, what Scilab max can not, so a emulation function called mtlb_max has been written.

Note that in Scilab, second input parameter can give the dimension to use to find the maximum values or another matrix (maximum of two matrices), in Matlab, dimension parameter is given in a third input parameter (in this case, second parameter must be []).

C=max(A)

If A is a matrix, max(A) is equivalent to max(A,[],1) in Matlab whereas in Scilab max(A) gives the maximum value found in A. Matlab max treats the values along the first non-singleton dimension.

Examples

Matlab Scilab
A = [1,2,3;4,5,6]
C = max(A)
C = [4,5,6]
C = max(A,[],1)
C = [4,5,6]
B = [7,8,9;2,3,4]
C = max(A,B)
C = [7,8,9;4,5,6]
A = [1,2,3;4,5,6]
C = max(A)
C = 6
C = max(A,"r")
C = [4,5,6]
B = [7,8,9;2,3,4]
C = max(A,B)
C = [7,8,9;4,5,6]
<< M M min (Matlab function) >>

Copyright (c) 2022-2024 (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:
Wed Jan 26 16:23:48 CET 2011