May 13, 2003 #1 korby Electrical May 5, 2003 7 DE 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??
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??
May 14, 2003 #2 suigeneris Computer Apr 23, 2003 8 DE 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 Upvote 0 Downvote
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
May 14, 2003 Thread starter #3 korby Electrical May 5, 2003 7 DE 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 Upvote 0 Downvote
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