Back to the main page.

Bug 3139 - improve support for R2016a

Status NEW
Reported 2016-06-09 09:59:00 +0200
Modified 2016-06-09 15:02:15 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P5 normal
Assigned to: Robert Oostenveld
URL:
Tags:
Depends on:
Blocks:
See also: http://bugzilla.fieldtriptoolbox.org/show_bug.cgi?id=3138

Robert Oostenveld - 2016-06-09 09:59:00 +0200

I just started matlab2016a and got this warning (after only calling ft_defaults). Warning: NARGCHK will be removed in a future release. Use NARGINCHK or NARGOUTCHK instead. > In base64encode (line 47) In ft_trackusage (line 128) In ft_defaults (line 255) In startup (line 66) In matlabrc (line 209) Warning: NARGCHK will be removed in a future release. Use NARGINCHK or NARGOUTCHK instead. > In base64encode (line 47) In ft_trackusage (line 141) In ft_defaults (line 255) In startup (line 66) In matlabrc (line 209)


Robert Oostenveld - 2016-06-09 14:59:41 +0200

The code below would be a solution, but better is to switch to narginchk. However, that is only available from 2011b onwards, so not so long. I suppose best is to replace the code with a try-catch to use either function. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % NARGCHK is deprecated in MATLAB versions from 2016a onwards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function str = nargchk(low, high, n, format) str = []; if nargin<4 format = 'string'; end switch format case 'string' if n<low str = 'Too few input arguments.'; elseif n>high str = 'Too many input arguments.'; end case 'struct' if n<low str.message = 'Too few input arguments.'; str.identifier = 'MATLAB:nargchk:tooManyInputs'; elseif n>high str.message = 'Too many input arguments.'; str.identifier = 'MATLAB:nargchk:tooManyInputs'; end otherwise error('The fourth input must be either ''struct'' or ''string''.'); end


Robert Oostenveld - 2016-06-09 15:02:15 +0200

(In reply to Robert Oostenveld from comment #1) mac011> git commit utilities/private/base64encode.m [master 8bd7006] use narginchk instead of nargchk on newer matlab versions, see http://bugzilla.fieldtriptoolbox.org/show_bug.cgi?id=3139 1 file changed, 11 insertions(+), 2 deletions(-)