How to create an interactive menu in the command window?

17 views (last 30 days)
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 Comment
Rik
Rik on 31 Oct 2021
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];

Sign in to comment.

Answers (1)

Rik
Rik on 30 Oct 2021
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 Comments
Loren99
Loren99 on 30 Oct 2021
@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 on 31 Oct 2021
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.

Sign in to comment.

Categories

Find more on MATLAB Coder in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!