Azzera filtri
Azzera filtri

How to add inputdlg to my code for taking input ?

6 visualizzazioni (ultimi 30 giorni)
%max chamber in terms of hunder
%max postion of chamber in terms of tenth
% thicknes
prompt={'enter max chamber','enter position of chamber','enter thicknes'};
title={'Input'};
dims = [1 65];
definput = {'2','2','12'};
answer=inputdlg(prompt,title,dims,definput)
m=answer*0.01;
p=answer*0.1;
t=answer*0.01;

Risposta accettata

Stephen23
Stephen23 il 3 Feb 2019
Modificato: Stephen23 il 3 Feb 2019
Read the inputdlg documentation: it clearly states that the output is "a cell array of character vectors containing one input per edit field, starting from the top of the dialog box". You need to access the contents of the output cell array (which will be character vectors, exactly as the documentation states):
prompt = {'enter max chamber','enter position of chamber','enter thicknes'};
dfin = {'2','2','12'};
answer = inputdlg(prompt,'Input',[1,65],dfin);
answer{1} % 1st input
answer{2} % 2nd input
answer{3} % 3rd input
If the inputs are single numbers and you want to convert them to numeric, simply use
vec = str2double(answers)
and then use indexing to access them in vec.

Più risposte (0)

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by