?? linesegment_plot.m
字號(hào):
function [hline] = linesegment_plot(x1, y1, x2, y2, lineProp)% linesegment_plot -- Plot a series of line segments on current plot axes.%%****f* wmtsa.plotutils/linesegment_plot%% NAME% linesegment_plot -- Plot a series of line segments on current plot axes.%% SYNOPSIS% [hline] = linesegment_plot(x1, y1, x2, y2, lineProp)%% INPUTS% x1 = vector of x-axis start points.% x1 = vector of y-axis start points.% x1 = vector of x-axis end points.% x1 = vector of y-axis start points.% lineProp = (optional) struct containing line properties to override.%% OUTPUTS% hline = vector containing handles to Line (segment) objects drawn.%% SIDE EFFECTS%%% DESCRIPTION% linesegment_plot plots a series of line segments defined by (x1,x2)->(x2,y2).% (x1,y1) are start points; (x2,y2) are end points.% % EXAMPLE%%% NOTES%%% REFERENCES%%% SEE ALSO%% AUTHOR% Charlie Cornish%% CREATION DATE% 2003/05/24%% COPYRIGHT%%% CREDITS%%% REVISION% $Revision: 612 $%%***% $Id: linesegment_plot.m 612 2005-10-28 21:42:24Z ccornish $ if nargerr(mfilename, nargin, [4:5], nargout, [0:1]) error_str = (['Usage: hline = ', mfilename, ... '(x1, y1, x2, y2, [lineProp])']); error(error_str);endNx1 = length(x1);Ny1 = length(y1);Nx2 = length(x2);Ny2 = length(y2);if (any([Nx1-Ny1, Nx1-Nx2, Nx1-Ny2])) error('Vectors are of unequal length');endlinePropName = {};linePropVal = {};if (exist('lineProp', 'var') && ~isempty(lineProp)) % Populate cell arrays for line property names and values. axes_field_names = fieldnames(lineProp); nfields = length(axes_field_names); for (i = 1:nfields) fname = axes_field_names{i}; linePropName(i) = {fname}; fval = lineProp.(fname); linePropVal(i) = {fval}; endendhline_segment_vec = [];for (i = 1:length(x1)) x = [x1(i), x2(i)]; y = [y1(i), y2(i)]; hline_segment = line(x, y); set(hline_segment, linePropName, linePropVal); hline_segment_vec = [hline_segment_vec, hline_segment];endif (nargout >= 1) hline = hline_segment_vec;endreturn
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -