MATLAB: Dlmwrite gives error message Too many output arguments.

dlmwriteMATLABtoo many output arguments

Dear Sir/Madam,
I have installed Matalb2018b on my Mac OSX 10.13.6. I am trying to use the function dlmwrite but it gives the error message: Too many output arguments. I am using a simple example from the dlmwrite help page. Please follow the commands given in the Command Windows:
>> M = magic(3);
>> dlmwrite dlmwrite('myFile.txt',M)
Error using dlmwrite (line 104)
Too many output arguments.
>>
>> dlmwrite("myFile.txt",M)
Error using dlmwrite (line 104)
Too many output arguments.
>>
>> which all dlmwrite
built-in (/Applications/MATLAB_R2018b.app/toolbox/matlab/ops/all)
>>
>> dbtype 'dlmwrite' 1
1 function dlmwrite(filename, m, varargin)
dlmwrite gives the "Too many output arguments" error message with Matlab 2018b and Matlab 2017b. Instead dlmwrite works fine with MAtlab 2016b and Matlab 2015a. All these versions are installed on this Mac.
Thank you

Best Answer

Use the debugger. It is the best friend of the programmer.
dlmwrite stops in line 104. This is the error handling part of a TRY/CATCH block. To catch an error inside such a block, type this in the command window:
dbstop if caught error
% or
dbstop if all error
Now dlmwrite will stop in the failing line. Maybe you have redefined iscell, cell2mat, error, message, parseinput, isnumeric, ischar strrep, .... The failing line will reveal this.
If the problem is really a redefintion, you can use this tool to detect collisions with built-in functions: File Exchange: UniqueFuncNames
Related Question