Mercurial > repos > public > sbplib
comparison +anim/setup_1d_plot.m @ 56:ce90abc350c5
Added documentation to setup_1d_plot. Added updatableLine.m
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 12 Nov 2015 12:03:45 -0800 |
parents | b21c53ff61d4 |
children | dbc50fa58ca6 |
comparison
equal
deleted
inserted
replaced
55:a8ed986fcf57 | 56:ce90abc350c5 |
---|---|
1 function [update_data,plot_handles] = setup_1d_plot(x,y_lim,yfun) | 1 % Creates a plot and provides a function to update the data in it. |
2 % x - Vector of x-values to plot for. | |
3 % y_lim - 1x2 vector containing the y limits of the plot. | |
4 % yfun - Function or a cell array of functions of y data vectors | |
5 % that should be plotted. The output of each function | |
6 % will be plotted to the same axis. | |
7 % | |
8 % update_data(t,varargin) - Function to update plot data. All varargin will | |
9 % be passed to functions in yfun. | |
10 % plot_handles - Array of plot_handles. One for each yfun. | |
11 % axis_handle - Handle to the axis plotted to. | |
12 function [update_data, plot_handles, axis_handle] = setup_1d_plot(x,y_lim,yfun) | |
2 default_arg('yfun',{@(y)y}); | 13 default_arg('yfun',{@(y)y}); |
3 | 14 |
4 if isa(yfun,'function_handle') | 15 if isa(yfun,'function_handle') |
5 yfun = {yfun}; | 16 yfun = {yfun}; |
6 end | 17 end |