dlmwrite gives error message Too many output arguments.

2 views (last 30 days)
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
  5 Comments
Jan
Jan on 22 Jan 2019
[MOVED from section for answers] Davide wrote:
Right, sorry
Here is the output of the command you suggested
>> which dlmwrite -all
/Applications/MATLAB_R2018b.app/toolbox/matlab/iofun/dlmwrite.m
Jan
Jan on 22 Jan 2019
Edited: Jan on 22 Jan 2019
Okay, than you are using the original version of dlmwrite. I assume, you have shadowed another function, which is called from inside dlmwrite. You can find this out using the debugger - see my answer.
By the way, thank you for saluting "Madams" explicitly. There are to many "hello guys" in this forum. :-)

Sign in to comment.

Accepted Answer

Jan
Jan on 22 Jan 2019
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
  4 Comments

Sign in to comment.

More Answers (0)

Categories

Find more on Downloads in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!