gpt4 book ai didi

MATLAB:如何重用绘图选项?

转载 作者:行者123 更新时间:2023-12-02 09:31:36 24 4
gpt4 key购买 nike

我有以下情节:

patch('Vertices',rocket_point_cloud,'Faces',rocket_faces,...
'FaceColor','red','EdgeColor','none',...
'BackFaceLighting','reverselit',...
'SpecularStrength',1,'DiffuseStrength',1)

我想重用绘图选项,即重用:

'FaceColor','red','EdgeColor','none',...
'BackFaceLighting','reverselit',...
'SpecularStrength',1,'DiffuseStrength',1

是否可以以某种方式将以上内容存储在变量中,例如my_options然后再做:

patch('Vertices',other_cloud,'Faces',other_faces,my_options)

感谢您的帮助!

最佳答案

当然。只需在 cell array 中定义您的选项即可,

my_options = {'FaceColor','red','EdgeColor','none',...
'BackFaceLighting','reverselit',...
'SpecularStrength',1,'DiffuseStrength',1};

然后将该元胞数组扩展为 comma-separated list通过大括号索引:

patch('Vertices', rocket_point_cloud, 'Faces', rocket_faces, my_options{:})

关于MATLAB:如何重用绘图选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32554537/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com