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

조회 수: 7 (최근 30일)
Giuseppe
Giuseppe 2021년 3월 4일
댓글: Giuseppe 2021년 3월 5일
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