Too many input arguments for Max function in 2018b

4 views (last 30 days)
Hi all,
I am using the function 'max' in its newest format for 2018b, as shown here, and I have the following code:
A = randi(361,15) ;
[E, i] = max(A, [], 'all', 'linear', 'omitnan') ;
However I am getting the error
Error using max
Too many input arguments.
The weird thing is that the above script works perfectly for my work computer with MATLAB 2019b. However in the current computer that I am using which has the 2018b version (which according to the mathworks website is supposed to support this format of the max function), it appears not to work. Any ideas as to why?
KR,
KMT
P.S. Here are the details for the MATLAB installed in the computer that returs the aforementioned error:
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.5.0.1178774 (R2018b) Update 5
MATLAB License Number: #######
Operating System: Mac OS X Version: 10.15.1 Build: 19B88
Java Version: Java 1.8.0_152-b16 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 9.5 (R2018b)
Simulink Version 9.2 (R2018b)
Automated Driving System Toolbox Version 1.3 (R2018b)
Communications Toolbox Version 7.0 (R2018b)
Computer Vision System Toolbox Version 8.2 (R2018b)
Control System Toolbox Version 10.5 (R2018b)
Curve Fitting Toolbox Version 3.5.8 (R2018b)
DSP System Toolbox Version 9.7 (R2018b)
Database Toolbox Version 9.0 (R2018b)
Datafeed Toolbox Version 5.8 (R2018b)
Deep Learning Toolbox Version 12.0 (R2018b)
Fixed-Point Designer Version 6.2 (R2018b)
Global Optimization Toolbox Version 4.0 (R2018b)
Image Processing Toolbox Version 10.3 (R2018b)
Instrument Control Toolbox Version 3.14 (R2018b)
LTE HDL Toolbox Version 1.2 (R2018b)
LTE Toolbox Version 3.0 (R2018b)
MATLAB Coder Version 4.1 (R2018b)
MATLAB Compiler Version 7.0 (R2018b)
MATLAB Compiler SDK Version 6.6 (R2018b)
MATLAB Report Generator Version 5.5 (R2018b)
Mapping Toolbox Version 4.7 (R2018b)
Model Predictive Control Toolbox Version 6.2 (R2018b)
Optimization Toolbox Version 8.2 (R2018b)
Parallel Computing Toolbox Version 6.13 (R2018b)
Partial Differential Equation Toolbox Version 3.1 (R2018b)
Phased Array System Toolbox Version 4.0 (R2018b)
Powertrain Blockset Version 1.4 (R2018b)
Predictive Maintenance Toolbox Version 1.1 (R2018b)
Signal Processing Toolbox Version 8.1 (R2018b)
SimEvents Version 5.5 (R2018b)
Simscape Version 4.5 (R2018b)
Simscape Driveline Version 2.15 (R2018b)
Simscape Electrical Version 7.0 (R2018b)
Simscape Fluids Version 2.5 (R2018b)
Simscape Multibody Version 6.0 (R2018b)
Simulink 3D Animation Version 8.1 (R2018b)
Simulink Check Version 4.2 (R2018b)
Simulink Coder Version 9.0 (R2018b)
Simulink Control Design Version 5.2 (R2018b)
Simulink Coverage Version 4.2 (R2018b)
Simulink Design Optimization Version 3.5 (R2018b)
Simulink Design Verifier Version 4.0 (R2018b)
Simulink Report Generator Version 5.5 (R2018b)
Statistics and Machine Learning Toolbox Version 11.4 (R2018b)
Symbolic Math Toolbox Version 8.2 (R2018b)
System Identification Toolbox Version 9.9 (R2018b)
>>

Accepted Answer

Adam Danz
Adam Danz on 17 Dec 2019
Edited: Adam Danz on 17 Dec 2019
The linear option in r2019b [M,I] = max(A,[],___,'linear') was not included in r2018b.
For r2018b you can use,
[E, i] = max(A(:), [], 'omitnan') ;
instead of
[E, i] = max(A, [], 'all', 'linear', 'omitnan') ;
  3 Comments
Adam Danz
Adam Danz on 17 Dec 2019
Edited: Adam Danz on 17 Dec 2019
Yes, these lines are equivilant. You could test that by entering a small matrix such as
A = magic(5);

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!