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

11 visualizaciones (últimos 30 días)
Giuseppe
Giuseppe el 4 de Mzo. de 2021
Comentada: Giuseppe el 5 de Mzo. de 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?

Respuesta aceptada

Ive J
Ive J el 5 de Mzo. de 2021
Editada: Ive J el 5 de Mzo. de 2021
h = findobj(gca,'Type','Patch');
h.FaceColor = 'b'; % set it to blue or whatever

Más respuestas (0)

Categorías

Más información sobre Guidance, Navigation, and Control (GNC) en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by