Drawing lines with a handle
古いコメントを表示
Hello. I am working on a project and I am having a hard time plotting a "line for each link". I have tried the plot and line function but I cannot seem to get them to plot and I keep getting errors like: "Error using line
Invalid data argument." or "Error using plot
Invalid data argument." If you could offer me any support on how to start figurimg out how to plot this I would greatly appreciate it.
function l = draw_links(link_set,link_colors,ax)
% Draw a set of lines for a link structure into a specified axis
%
% Inputs:
%
% link_set: A 1xn cell array, each entry of which is a matrix whose
% columns are the endpoints of the lines describing one link of the
% system (as constructed by planar_build_links or
% planar_build_links_prismatic
% link_colors: 1x3 cell array. Each entry can be either a standard matlab
% color string (e.g., 'k' or 'r') or a 1x3 vector of the RGB values
% for the color (range from 0 to 1)
% ax: The handle to an axis in which to plot the links
%
% Output:
%
% l: A cell array of the same size as link_set, in which each entry is a
% handle to a line structure for that link
%%%%%%%%
% Start by creating an empty cell array of the same size as link_set,
% named 'l'
l = cell(link_set);
%%%%%%%%
% Draw a line for each link, with circles at the endpoints, and save
% the handle for this line in the corresponding element of 'l'
link_colors = {'k','r','g'};
l{1} = plot(link_set,ax);
end
1 件のコメント
Stephen23
2022 年 3 月 5 日
"Output... A cell array of the same size as link_set, in which each entry is a handle to a line structure for that link"
One graphics object array would probably be simpler to work with:
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Title についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

