comparison +anim/setup_time_quantity_plot.m @ 69:f87003695677

Moved drawno out of plot update functions for huge performance boost.
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 23 Nov 2015 13:54:01 +0100
parents 48b6fb693025
children 243c558dc3ae
comparison
equal deleted inserted replaced
68:f9a65e62c5e5 69:f87003695677
1 function [update_data, plot_handles] = setup_time_quantity_plot(yfun) 1 function [update_data, plot_handles] = setup_time_quantity_plot(yfun)
2 default_arg('yfun',@(y)y); 2 default_arg('yfun',@(y)y);
3
4 if isa(yfun,'function_handle')
5 yfun = {yfun};
6 end
3 7
4 t = []; 8 t = [];
5 for i = 1:length(yfun) 9 for i = 1:length(yfun)
6 plot_handles(i) = line(0,0); 10 plot_handles(i) = line(0,0);
7 plot_handles(i).XData = []; 11 plot_handles(i).XData = [];
19 for j = 1:length(yfun) 23 for j = 1:length(yfun)
20 quantities{j} = [quantities{j} yfun{j}(varargin{:})]; 24 quantities{j} = [quantities{j} yfun{j}(varargin{:})];
21 plot_handles(j).XData = t; 25 plot_handles(j).XData = t;
22 plot_handles(j).YData = quantities{j}; 26 plot_handles(j).YData = quantities{j};
23 end 27 end
24 drawnow
25 end 28 end
26 end 29 end
27 update_data = @update; 30 update_data = @update;
28 end 31 end