Curve fitter app does not work
10 ビュー (過去 30 日間)
古いコメントを表示
I used online MATLAB; however, I could not fit the curve using Curve fitter app.
There are errors presented at the command window as;
Error in matlab.ui.internal.toolstrip.base.ActionInterface>@(event,data)PropertySetCallback(this,event,data) (line 40)
this.PropertySetListener = addlistener(this.Peer, 'propertySet', @(event, data) PropertySetCallback(this, event, data));
Error in viewmodel.internal.factory.ManagerFactoryProducer>@(src,event)callback(src,viewmodel.internal.factory.ManagerFactoryProducer.convertStructToEventData(event)) (line 79)
proxyCallback = @(src, event)callback(src, ... > In cfapp.internal.curvefitter.ui.toolstrip/FitSectionView/set.AutoFitState (line 60)
In cfapp.internal.curvefitter.ui.toolstrip/FitSectionView/autoFitRadioButtonClicked (line 138)
In cfapp.internal.curvefitter.ui.toolstrip.FitSectionView>@(varargin)this.autoFitRadioButtonClicked(varargin{:}) (line 116)
In internal.Callback.execute (line 128)
In matlab.ui.internal.toolstrip.base/Action/PropertySetCallback (line 782)
In matlab.ui.internal.toolstrip.base.ActionInterface>@(event,data)PropertySetCallback(this,event,data) (line 40)
In viewmodel.internal.factory.ManagerFactoryProducer>@(src,event)callback(src,viewmodel.internal.factory.ManagerFactoryProducer.convertStructToEventData(event)) (line 79)
7 件のコメント
採用された回答
Steven Lord
2024 年 6 月 19 日
Rename your script fit.m so it does not conflict with the fit function from Curve Fitting Toolbox. The app uses fit as part of its execution.
4 件のコメント
Steven Lord
2024 年 6 月 19 日
@Torsten For built-in functions, MATLAB issues a warning if you cd into a directory that contains a MATLAB code file of the same name or add that directory to the MATLAB search path. Here I'll make such a directory containing a sin.m file (sin is most definitely a built-in function.)
cd(tempdir)
name = 'stuff2129806';
mkdir(name)
fid = fopen(fullfile(name, 'sin.m'), 'wt');
fprintf(fid, 'function y = sin(y)');
fclose(fid);
When I cd into that directory, I receive a warning. [I'm not sure offhand why it displays twice, once like it was being disp-ed and once as a warning.]
cd(name)
Now I'll cd out of that directory (no warning necessary here) then add that directory to the search path.
cd ..
P = path;
addpath(name)
For MATLAB code files, like in this case fit.m (from Curve Fitting Toolbox) or something like ode45.m (in MATLAB), it does not. First let's restore the path to how it was before I called addpath so the sin.m is no long "visible" to MATLAB, then make an ode45.m. This is a function in MATLAB.
path(P)
which -all ode45
fid = fopen(fullfile(name, 'ode45.m'), 'wt');
fprintf(fid, 'function z = ode45(y)\nz = y.^2;');
fclose(fid);
Now if I cd into that directory I receive the same warning about sin but no warning about ode45. You can also see that the ode45.m I created is visible to MATLAB and callable.
cd(name)
which -all ode45
ode45(1:10)
Should MATLAB warn about all MATLAB code files that share a name with a file in a MathWorks toolbox and/or add-on you have installed? I don't know what the performance implications of that check would be or just how noisy it would be. You can see how many times the warning about sin.m was issued above. Now picture the directory had 10, 20, 100 functions that share a built-in function's name.
It also wouldn't necessarily detect files in a product you don't have installed now but install later as an Add-On (or we'd have to redo the check as soon as you installed the new Add-On, which could be a MathWorks product.) Then there are files in namespaces that you can import -- do those warn about conflicts as soon as that namespace is imported? What implication does that have on existing users of import?
And why should MathWorks toolboxes get all the protection? Should toolboxes authored by developers outside MathWorks (like Psychtoolbox, which comes up reasonably often on Answers) be able to buy into warning if others shadow their functions?
If you feel strongly it could help it's worth an enhancement request to Technical Support, particularly if you have a list of Answers posts where it would have avoided the problem in the post entirely. [Our developers love real-world use cases to consider when designing features! And no, that's not sarcastic.] But IMO there are enough questions and potential gotchas in my mind that I think it would warrant some careful thought and design to decide when/how/if to implement it.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Introduction to Installation and Licensing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!