×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

input dialog box

input dialog box

input dialog box

(OP)
I want to use the input dialog box.
The user has to enter some parameters for the simulation(numbers).
How can I transform the single elements of the cell array into numbers ( double arrays) so that I can calculate with them??

RE: input dialog box

Hi,
that was a problem for me too. But I found a solution.
I needed two entries:

%%input dialog box%%%
prompt = {'Enter gain:','Enter range:'};
dlg_title = 'Enter values';
num_lines= 1;
def     = {'20','256'};       %default
answer  = inputdlg(prompt,dlg_title,num_lines,def);

%%%to get the two entered values%%%%
A = getfield(answer,{1});    %first input field
A = str2double(A);

B = getfield(answer,{2});   %second input field
B = str2double(B);

Hope I could help

sui

RE: input dialog box

(OP)
Hi Suigeneris,
thanks a lot for your tip!!

actually the 'getfield' causes a erroermessage:

??? Error using ==> getfield
Error using ==> subsref
Index exceeds matrix dimensions.

Error in ==> C:\Programme\Matlab\work\Untitled.m
On line 9  ==> A = getfield(answer,{1});    %first input field

but if I just take the content of the array with
'a=answer{1}' for example --> it works.

str2double was the expression I was looking for !!

Thanks again

cheers Korby

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources