Receiving "Too many return arguments are specified. Specify only one."

I am trying to run a very simple code that gives me whatever values. I am new to MATLAB and I am just practicing. I have the following simulink diagram
and my .m is the following
options = simset;
options = simset('MaxStep',1,'MinStep',1e-5,'AbsTol',1e-3);
tf = 10;
[t,xv] = sim('vdpol',tf,options);
Once I can get t and xv I can perform plots but I seem to not get past that 7th line
Error using vdpolmat (line 7)
Too many return arguments are specified. Specify only one.
Like I said I am learning here and I know I am missing something dumb.

댓글 수: 4

David Sheets
David Sheets 2019년 10월 20일
편집: David Sheets 2019년 10월 20일
So I solved why > [t,xv] = sim('vdpol',tf,options); was returning an error of too many return arguments.
I found that "Starting with R2009b, the sim command was enhanced to provide greater compatibility with parallel computing. The improved single-output format saves all simulation results to a single object, simplifying the management of output variables.
For backward compatibility with R2009a or earlier releases, use the backward-compatible syntax:
[T,X,Y] = sim('model',Timespan, Options, UT)
[T,X,Y1,...,Yn] = sim('model',Timespan, Options, UT)
If you specify only the model argument, Simulink automatically saves the time, state, and output to the specified output arguments.
If you do not specify any output arguments, Simulink determines what data to log based on the settings for the Configuration Parameters > Data Import/Export pane. Simulink stores the simulation output either in the current workspace or in the variable ans, based on the setting for Save simulation output as a single object parameter"
This means I needed to go into Model Settings > Data Import/Export pane and UNCHECK Single simulation output since I had the arguments [t, vx] on MATLAB R2019b.
More information can be found on:
Hope this may help someone else.
A big Thank you!
Thank you so much, saved me the night before my deadline
6 years later but THANK YOU!! I was getting that same mind breaking mistake and couldnt find how to fix it, you saved me :)

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Event Functions에 대해 자세히 알아보기

질문:

2019년 10월 20일

댓글:

2025년 2월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by