How to imitate Matlab's plot function in plot function made by user?
1 回表示 (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
回答 (1 件)
Stephen23
2015 年 7 月 30 日
編集済み: Stephen23
2015 年 7 月 30 日
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 件のコメント
Stephen23
2015 年 7 月 30 日
My Pleasure! It is considered polite on this forum to Accept an Answer that best help resolve your question.
参考
カテゴリ
Help Center および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!