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

11 Ansichten (letzte 30 Tage)
Giuseppe
Giuseppe am 4 Mär. 2021
Kommentiert: Giuseppe am 5 Mär. 2021
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?

Akzeptierte Antwort

Ive J
Ive J am 5 Mär. 2021
Bearbeitet: Ive J am 5 Mär. 2021
h = findobj(gca,'Type','Patch');
h.FaceColor = 'b'; % set it to blue or whatever

Weitere Antworten (0)

Kategorien

Mehr zu Guidance, Navigation, and Control (GNC) finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by