How to change color of imported geometry from .mat file?

8 次查看(过去 30 天)
Hi guys!
The professor of flight dynamics course has given to me a code to plot an aircraft in a refernce system. I import in the code the .mat file in which there is the aircraft geometry but I cannot change the default color (red) to another color (for example cyan).
This is the code:
%% Setup the figure/scene
h_fig2 = figure(2);
light('Position',[2 4 -4],'Style','local');
% Trick to have Ze pointing downward and correct visualization
set(gca,'XDir','reverse'); set(gca,'ZDir','reverse');
grid on; hold on;
%% Load aircraft shape
shapeScaleFactor_bis = 1.0;
shape_bis = loadAircraftMAT('Embraer_phenom_100.mat', shapeScaleFactor_bis);
%% Set the aircraft in place
% Posision in Earth axes
vXYZe = [2,2,-2];
% psi, theta, phi -> 'ZYX'
vEulerAngles = convang([20,10,0],'deg','rad');
% Observer point-of-view
theView = [120 20];
% body axes settings
bodyAxesOptions.show = true;
bodyAxesOptions.magX = 2.0*shapeScaleFactor_bis;
bodyAxesOptions.magY = 2.0*shapeScaleFactor_bis;
bodyAxesOptions.magZ = 1.5*shapeScaleFactor_bis;
bodyAxesOptions.lineWidth = 2.5;
plotBodyE(h_fig2, shape_bis, ...
vXYZe, vEulerAngles, ...
bodyAxesOptions, theView);
Edit: I discovered that I can change the color in the function plotBodyE.m, but I wish to change the color inside the code that I've attached here (without modyfing the function). Can you help me?

采纳的回答

Ive J
Ive J 2021-3-5
编辑:Ive J 2021-3-5
h = findobj(gca,'Type','Patch');
h.FaceColor = 'b'; % set it to blue or whatever

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Guidance, Navigation, and Control (GNC) 的更多信息

产品


版本

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by