How to create an interactive menu in the command window?

28 次查看(过去 30 天)
Hi everyone! I need to make this code smarter and more interactive. In particular, I would like the user to select the presence or absence of panels in the command window; for example in the following code in addition to the body of the object (a cube so 6 facets) there are two panels (each of these two panels has 2 planes, therefore 4 total planes and therefore a matrix u_normale_panels 4x3 ). Each of these panels has an area of 20 m^2 and a reflectivity of 0.8. I would like the user to choose IN THE COMMAND WINDOW whether or not there are additional panels(and consequently the total number of facets), their area (area panels) and their reflectivity (rho_panels)in order to obtain the elements that I have defined as u_normale, rho and area in the code.
  1 个评论
Rik
Rik 2021-10-31
Why did you edit away your code?
%% Geometric characteristics of the spacecraft
height = 600000; % m
number_facets = 10; %object + panels
u_normale_body = [1,0,0; ...
-1,0,0; ...
0,1,0; ...
0,-1,0; ...
0,0,1; ...
0,0,-1];
u_normale_panels = [1,0,0; ...
-1,0,0; ...
1,0,0; ...
-1,0,0];
u_normale = [u_normale_body; u_normale_panels];
rho_body = [0.5,0.5,0.5,0.5,0.5,0.5];
rho_panels = [0.8,0.8,0.8,0.8];
rho = [rho_body,rho_panels];
area_facets = [9,9,9,9,9,9]; %m^2
area_panels = [20,20,20,20]; % m^2
area = [area_facets,area_panels];

请先登录,再进行评论。

回答(1 个)

Rik
Rik 2021-10-30
doc input
Although in general a GUI will be nicer for your user. For general advice and examples for how to create a GUI (and avoid using GUIDE), have look at this thread.
  2 个评论
Loren99
Loren99 2021-10-30
@Rik I don't have familiarity with GUI. Could you explain me how can I adapt it to my code and my requests? Thanks in advance
Rik
Rik 2021-10-31
Have you read the linked page? GUI is short for graphical user interface, so it is a way to give your user a visual way to interact with the functions you created.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 MATLAB Coder 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by