20 views (last 30 days)
Show older comments
Tom Keaton on 20 Jun 2018
-
-
Link
Direct link to this question
https://www.mathworks.com/matlabcentral/answers/406613-how-can-i-fix-not-enough-input-arguments-error-in-this-script
Answered: KSSV on 21 Jun 2018
Open in MATLAB Online
Input:
t = 0:pi/50:10*pi;
x = (1/2)*(sin(2*t))+1;
y = (1/2)*(cos(2*t))+1;
z = 2*t;
plot3(x,y,z,t,'r','LineWidth',3)
Output:
Error using plot3
Not enough input arguments.
Error in testfunc (line 6)
plot3(x,y,z,t,'r','LineWidth',3)
11 Comments Show 9 older commentsHide 9 older comments
Show 9 older commentsHide 9 older comments
Sophia on 20 Jun 2018
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/406613-how-can-i-fix-not-enough-input-arguments-error-in-this-script#comment_580646
Edited: Sophia on 20 Jun 2018
Open in MATLAB Online
t = 0:pi/50:10*pi
x = (1/2)*(sin(2*t))+1;
y = (1/2)*(cos(2*t))+1;
z = 2*t;
figure(2);
plot3(x,y,z,'r','LineWidth',3)
Stephen23 on 20 Jun 2018
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/406613-how-can-i-fix-not-enough-input-arguments-error-in-this-script#comment_580648
@Tom Keaton: please show us the complete error message. This means all of the red text.
OCDER on 20 Jun 2018
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/406613-how-can-i-fix-not-enough-input-arguments-error-in-this-script#comment_580651
Code works for me without error. Is there more to it?
Tom Keaton on 20 Jun 2018
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/406613-how-can-i-fix-not-enough-input-arguments-error-in-this-script#comment_580697
Edited: Tom Keaton on 20 Jun 2018
@sophia Unfortunately, this did not work :/
Tom Keaton on 20 Jun 2018
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/406613-how-can-i-fix-not-enough-input-arguments-error-in-this-script#comment_580700
@Stephen Cobeldick The post is updated so "Output" shows all the red text I see.
Geoff Hayes on 20 Jun 2018
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/406613-how-can-i-fix-not-enough-input-arguments-error-in-this-script#comment_580708
Edited: Geoff Hayes on 20 Jun 2018
Tom - which version of MATLAB are you using? If you look at that the documentation for that version (call doc plot3 from the command line) does your code satisfy the documentation description (in particular the signature for plot3)?
Note that the online documentation is for the most recent version of MATLAB (you can find archived versions though) so it may conflict with whatever version you have.
OCDER on 20 Jun 2018
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/406613-how-can-i-fix-not-enough-input-arguments-error-in-this-script#comment_580711
Open in MATLAB Online
@sophia's code worked for me.
plot3(x,y,z,t,'r','LineWidth',3)
^ ^ your code has an extra t or z input.
Maybe Mathworks could change the error message to something like this:
Error using plot3
Incorrect number of input arguments.
So what do you expect a 3D plot will do with 4 dimensions of data - (x, y, z, t)? Maybe you need another plot, or a video perhaps?
Tom Keaton on 20 Jun 2018
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/406613-how-can-i-fix-not-enough-input-arguments-error-in-this-script#comment_580716
@OCDER That was the issue. I got rid of the extra variable and it works now. I thought I was supposed to define the independent variable per MatLab formatting but I guess that was not the case. Thanks.
Greg on 21 Jun 2018
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/406613-how-can-i-fix-not-enough-input-arguments-error-in-this-script#comment_580768
"Not enough input arguments" is the correct error message because plot3 allows indefinite triplets of x,y,z inputs. Therefore, it thinks "t" is the first dimension of the second triplet, meaning 2 more inputs must follow.
OCDER on 21 Jun 2018
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/406613-how-can-i-fix-not-enough-input-arguments-error-in-this-script#comment_580787
@Tom, glad it worked!
@Greg, I guess that explains why Mathworks put that error message. But, "Incorrect number of input arguments" INCLUDES "Not enough input arguments" AND "Too many input arguments". In this case, there was too many input arguments, which was the opposite of "not enough input arguments" - this could make debugging a little confusing.
Greg on 21 Jun 2018
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/406613-how-can-i-fix-not-enough-input-arguments-error-in-this-script#comment_580790
Maybe you're right. Personally, MATLAB's documentation makes 100% perfect sense to me, so I just look up the calling syntax and fix it. It's probably the single most prominent reason I'm proficient with MATLAB - my brain just works exactly the way the documentation is laid out. Others might not be so lucky.
Sign in to comment.
Sign in to answer this question.
Answers (1)
KSSV on 21 Jun 2018
Open in MATLAB Online
t = 0:pi/50:10*pi;
x = (1/2)*(sin(2*t))+1;
y = (1/2)*(cos(2*t))+1;
z = 2*t;
plot3(x,y,z,'r','LineWidth',3)
You need not plot t here. plot3 takes only three inputs of data i.e (x,y,z).
0 Comments Show -2 older commentsHide -2 older comments
Show -2 older commentsHide -2 older comments
Sign in to comment.
Sign in to answer this question.
See Also
Categories
MATLABGraphics2-D and 3-D PlotsLine Plots
Find more on Line Plots in Help Center and File Exchange
Tags
- input arguments
- arguments
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- Deutsch
- English
- Français
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
Contact your local office