From: Nathan on 27 Apr 2010 17:35 On Apr 27, 2:10 pm, "carlos " <parryonl...(a)wanadoo.es> wrote: ----SNIP---- > > % --- Executes on button press in pushbutton1. > > function pushbutton1_Callback(hObject, eventdata, handles) > > % Inputs necesarios > > k=get(handles.edit1,'String'); > > k=str2double(k); > > s0=get(handles.edit2,'String'); > > s0=str2double(s0); > > T=get(handles.edit3,'String'); > > T=str2double(T); > > sigma=get(handles.edit4,'String'); > > sigma=str2double(sigma); > > N=get(handles.edit6,'String'); > > N=str2double(N); > > dt=str2double(T/N); > > d=str2double(exp(-sigma*sqrt(dt))); > > u=str2double(exp(sigma*sqrt(dt))); > > intereses=get(handles.edit7,'String'); > > int0=log(1+intereses); > > int0=str2double(int0); > > disp(int0) Alright. Do you know what you are doing in here? First, you are reading in strings from edit boxes and turning those into doubles (using str2double). That is fine. The line that doesn't make any sense is: dt=str2double(T/N); Note that T and N are already doubles, as you have already converted them from strings to doubles. Doing str2double on anything that is NOT a string will return NaN (read the documentation carefully. "If str does not represent a valid scalar value, str2double returns NaN."). Perhaps that's where you are going wrong. Just write dt=T/N instead of doing the erroneous conversion again. Hope that helps. -Nathan
From: carlos on 27 Apr 2010 17:45
Oh no!!! I found a new issue, when I change the default values from the edit texts it appears an error. One of the main purposes for doing this guide is to be able to change these values as much as I want. Any suggestion?? |