Effacer les filtres
Effacer les filtres

How to imitate Matlab's plot function in plot function made by user?

1 vue (au cours des 30 derniers jours)
Ali Y.
Ali Y. le 30 Juil 2015
Commenté : Stephen23 le 30 Juil 2015
I have created a plot function with three arguments as
fun(xvar, norm1, var1)
plot(xvar, fun(norm1,var1))
end
My problem is that I can't assign some attributes to the plot function, as It is possible in Matlab's default plot function. To be specific, I want to change plot's properties like line style, color and etc in my function. How should I change the function to do this? Like:
fun(xvar, norm1, var1, 'color', 'r', 'linestyle', '--')
Any help is appreciated.

Réponses (1)

Stephen23
Stephen23 le 30 Juil 2015
Modifié(e) : Stephen23 le 30 Juil 2015
function my_fun(xvar, norm1, var1, varargin)
plot(xvar, other_fun(norm1,var1), varargin{:});
end
This simply passes any extra optional arguments directly to plot.
  2 commentaires
Ali Y.
Ali Y. le 30 Juil 2015
Thank you very much for your help.
Stephen23
Stephen23 le 30 Juil 2015
My Pleasure! It is considered polite on this forum to Accept an Answer that best help resolve your question.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by