Prev: removing some egdes from graph.G . And after remoiving edges it shuold be k-connected
Next: Replacing a NaN by it nanmean
From: Alex Pereira on 1 Jul 2010 16:32 I've used the curve fitting GUI tool to setup some data, smooting and fitting options. Then, I've generated a M-File by using the option in the menu File of this tool. It generated a file that contain this piece of code below. When I try to using this function in any data, includig the one used to setup the data in the GUI, the following error message apears. ===== Error Message =========== ??? Undefined function or variable "sm_". Error in ==> createFit at 48 x_2 = (1:numel(sm_.y2))'; ===== End of Error Message ====== The 48h line is the one before last in the piece of code below. Can anyone help to fix this code ? Thank you very much, Alex ===== Piece of Code====== function createFit(r4) % Set up figure to receive datasets and fits f_ = clf; figure(f_); set(f_,'Units','Pixels','Position',[468 141 620 427]); legh_ = []; legt_ = {}; % handles and text for legend xlim_ = [Inf -Inf]; % limits of x axis ax_ = axes; set(ax_,'Units','normalized','OuterPosition',[0 0 1 1]); set(ax_,'Box','on'); axes(ax_); hold on; % --- Plot data originally in dataset "r4" x_1 = (1:numel(r4))'; r4 = r4(:); h_ = line(x_1,r4,'Parent',ax_,'Color',[0.333333 0 0.666667],... 'LineStyle','none', 'LineWidth',1,... 'Marker','.', 'MarkerSize',12); xlim_(1) = min(xlim_(1),min(x_1)); xlim_(2) = max(xlim_(2),max(x_1)); legh_(end+1) = h_; legt_{end+1} = 'r4'; % --- Plot data originally in dataset "r4 (smooth)" x_2 = (1:numel(sm_.y2))'; sm_.y2 = smooth(x_2,r4,5,'moving',0); .... ===== end of piece of code =======
From: us on 1 Jul 2010 17:16 "Alex Pereira" <alexlopespereira(a)gmail.com> wrote in message <i0iu0l$552$1(a)fred.mathworks.com>... > I've used the curve fitting GUI tool to setup some data, smooting and fitting options. Then, I've generated a M-File by using the option in the menu File of this tool. > It generated a file that contain this piece of code below. When I try to using this function in any data, includig the one used to setup the data in the GUI, the following error message apears. > > ===== Error Message =========== > ??? Undefined function or variable "sm_". > Error in ==> createFit at 48 > x_2 = (1:numel(sm_.y2))'; > ===== End of Error Message ====== > % --- Plot data originally in dataset "r4 (smooth)" > x_2 = (1:numel(sm_.y2))'; > sm_.y2 = smooth(x_2,r4,5,'moving',0); the problem is obvious and strange, indeed... which ML/cfit tbx version do you use(?)... can you produce a command line version of your fitting process, ie, the model, its options, which CSSMers can copy/paste(?)... us
From: Alex Pereira on 1 Jul 2010 23:31
"us " <us(a)neurol.unizh.ch> wrote in message <i0j0ik$nfc$1(a)fred.mathworks.com>... > "Alex Pereira" <alexlopespereira(a)gmail.com> wrote in message <i0iu0l$552$1(a)fred.mathworks.com>... > > I've used the curve fitting GUI tool to setup some data, smooting and fitting options. Then, I've generated a M-File by using the option in the menu File of this tool. > > It generated a file that contain this piece of code below. When I try to using this function in any data, includig the one used to setup the data in the GUI, the following error message apears. > > > > ===== Error Message =========== > > ??? Undefined function or variable "sm_". > > Error in ==> createFit at 48 > > x_2 = (1:numel(sm_.y2))'; > > ===== End of Error Message ====== > > > % --- Plot data originally in dataset "r4 (smooth)" > > x_2 = (1:numel(sm_.y2))'; > > sm_.y2 = smooth(x_2,r4,5,'moving',0); > > the problem is obvious and strange, indeed... > which ML/cfit tbx version do you use(?)... > can you produce a command line version of your fitting process, ie, the model, its options, which CSSMers can copy/paste(?)... > > us Hi Mr. Us, I've tested it under Matlab 2007, 2008 and 2009 on linux. The cfit version is 2.1 on Matlab 2009. I dont know how to produce such command line. Maybe it is not possible. But trying to learn it I've simplified the test by just creating a data test and a data smoothed test, and then saving it in a M-File. As a result this simplified test generate the same error. Studing the smooth function it can receive the y parameter or both y and x. When you provide only y data, it assumes the x data starts at 1 and increment one at each new y value. The code generated by the tool does not consider it. Then i fixed the generated code and it works fine. My correction code substitute the lines 48 and 49 by these: x_2 = (1:numel(sm_.y2))'; sm_.y2 = smooth(x_2,r4,5,'moving',0); Thank you very much. Alex |