Back to the main page.

Bug 3352 - MATLAB compatibility with narginchk/nargoutchk

Reported 2017-09-22 11:38:00 +0200
Modified 2018-11-12 10:54:11 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Linux
Importance: P5 normal
Assigned to: Jan-Mathijs Schoffelen
Depends on:
See also:

Guillaume - 2017-09-22 11:38:22 +0200

A number of functions use narginchk() which was introduced in MATLAB R2011b. nargoutchk() is an older function but it is used with two arguments only, which is a syntax introduced in R2011b too. Would it be possible for FieldTrip not reyling on these functions?

Guillaume - 2017-10-18 11:20:44 +0200

I understand that FieldTrip aims at compatibility to MATLAB versions up to 5 years old (we aim backward compatibility to R2007a for SPM12) and that the 'compat' folder smoothes out most incompatibility issues but it seems to me that the calls to narginchk() and nargoutchk() in ft_convert_units.m and ft_determine_units.m are unnecessary anyway as MATLAB analyses the function call syntax from the code of the function itself and returns error messages "Too many/not enough input/output arguments" even in the absence of narginchk/nargoutchk.

Jan-Mathijs Schoffelen - 2017-11-09 18:04:22 +0100

Good point, Guillaume. I have missed automatic e-mail messages from bugzilla (I only realised this today) so I only picked this up right now. I think you have a good argument here. I'll look into it.

Jan-Mathijs Schoffelen - 2018-10-08 16:41:52 +0200

slipped off the radar, and brought back to my attention by Guillaume. Followed up on github, and solved (I think).

Jan-Mathijs Schoffelen - 2018-11-12 10:54:11 +0100

closing time.