Filter löschen
Filter löschen

program to get the user to enter the values

1 Ansicht (letzte 30 Tage)
buxZED
buxZED am 24 Feb. 2011
function y=mx+c
how can i write a program to get the user to enter the values for x and c and display the result for y

Akzeptierte Antwort

Davide Ferraro
Davide Ferraro am 24 Feb. 2011
If you are expecting a command line input you can use the INPUT command:
A quick and nice graphic way is to use the function INPUTDLG:
  2 Kommentare
buxZED
buxZED am 24 Feb. 2011
clear
clc
stu_id=0.2529;
prompt = {'Gravity (g):','Angle (a):','iv (V0):'};
dlg_title = 'Enter the values for';
num_lines = 1;
def = {'9.81','35','25.820880000000002'};
answer = inputdlg(prompt,dlg_title,num_lines,def);
how do i now use the user provided data?
Walter Roberson
Walter Roberson am 24 Feb. 2011
See the separate question you posted on this.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 24 Feb. 2011
Consider also questdlg()

Kategorien

Mehr zu Dialog Boxes finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by