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??
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
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
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