How do you resolve conflict when multiple toolboxes have functions with the same name?
조회 수: 30 (최근 30일)
이전 댓글 표시
When I call the smooth function, I want the smooth function from the curve fitting toolbox which simply does a moving average of my data. However, Matlab runs the smooth function from the econometrics toolbox, which appears to be entirely different. How do I specify that I want the smooth function from the curve fitting toolbox?
댓글 수: 1
Benoit Espinola
2020년 6월 15일
As a feedback for Mathworks. This is extremely bad programming practices. Users get confused and waste their time because of this. Unacceptable for a paid tool.
채택된 답변
Sean de Wolski
2014년 12월 15일
which -all smooth
C:\Program Files\MATLAB\R2015aPre\toolbox\curvefit\curvefit\smooth.m
C:\Program Files\MATLAB\R2015aPre\toolbox\econ\econ\@ssm\smooth.m % ssm method
The only way econ's smooth will be called is if you have an ssm object. In this case, the smooth method for ssm will be used as curve fitting's smooth has no knowledge of how to work on an ssm object.
댓글 수: 5
Sean de Wolski
2014년 12월 15일
I highly doubt that Econ is being called if no ssm object exists and that smooth is not recursive!
Furthermore, I will bet (a $1 or a beer!) that your third party smooth is on the top of the list and has something in it that is recursive (maybe not smooth itself but it could be calling something else that is). This is far and away the most common thing that MathWorks Tech Support sees.
Since MATLAB has a global namespace, there is really no way to have multiple files named the same thing at the same time. You could rename the third party smooth or put it in a package/class to hide it from the global namespace (like what econ's ssm did and why I guarantee it's not being called!).
추가 답변 (3개)
khadija el maati
2017년 4월 2일
i had falling in the same problem with the function findpeaks wich is defined in the toolbox signal/signal and wich is defined in the toolbox plot_hht (Matlab 2013) .the solution for me was to move the position of the toolbox signal up to the toolbox plot_hht ..for this go to:home-->Set Path-->clic in signal toolbox-->clic in the Move up botton to give a priority to signal toolbox than the plot_hht toolbox
Sinan Islam
2022년 6월 11일
I solved this problem by packaging the conflicting function.
I have two functions, both named "pca". The first pca function is in the Statistics & ML toolbox, and the second pca function from a file I downloaded from Matlab File Exchange Community.
I packaged the second pca function by simply adding a plus sign to the folders containing it.
So if the conflicting pca function is contained within 5 folders, you have to add plus sign to every folder.
In case you needed to use the packaged function, you have to explicitly import it.
Note: You need to remove the conflicting function from the namespace before packaging it, then add it back when done.
댓글 수: 0
Deependra Mishra
2022년 7월 29일
I had the similar issue, I want to use classify.m function from nnet toolbox, however, when I use, it calls the classify method from stats toolbox.
which -all classify
C:\Program Files\MATLAB\R2022a\toolbox\stats\stats\classify.m
C:\Program Files\MATLAB\R2022a\toolbox\nnet\cnn\@DAGNetwork\classify.m % DAGNetwork method
In Set Path, nnet toolbox is above the stats toolbox. How do I call the classify method from nnet toolbox?
댓글 수: 4
Deependra Mishra
2022년 7월 30일
편집: Deependra Mishra
2022년 7월 30일
I did provide the correct argument to the classify method, still it was calling the method from stats toolbox.
Following is the line of code i used to call the classify method.
[YPred,probs] = classify(Net,imds,'MiniBatchSize',32);
Net --> DAGNetwork
imds --> imagedatastore
Walter Roberson
2022년 7월 30일
perhaps you do not have the Deep Learning Toolbox installed or licensed
What shows up for
whos Net
which classify(Net)
which -all classify
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!