I want my function to ignore some inputs

8 views (last 30 days)
Tiago Dias
Tiago Dias on 2 May 2018
Commented: Tiago Dias on 3 May 2018
Hello, I made a function called plotgeral that makes plots what I want with the format that I desire.
the 1st line of the function where i declare my outputs and inputs is:
out = plotgeral(Y,Y1,Y2,Y3,Y4,Y5,Xaxis title,Yaxis title,title,legend,legend1,legend2,legend3,legend4,legend5)
Sometimes I want to draw the plot with 6 inputs of data (Y -> Y5), but sometimes I just want the Y and Y1, for example. What should I do in this case? The name of Axis, title and legend are defined by me in the script with ' '.
I tried
out = plotgeral(Y,Y1,[],[],[],[],Xaxis title,Yaxis title,title,legend,legend,[],[],[],[])
but I get an error on the part of the legend, because [] it an invalid argument for the legend.
Thanks for your time.
Tiago Dias
Tiago Dias on 3 May 2018
Thanks it works, had to change the colours to black yellow blue etc, the full name, just the letters for some reason gave me a problem.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by