Unable to run local function "myparse"
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am unable to run a local function "myparse" even though it is already on my path. Anyone has any idea how to solve this?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1799810/image.png)
>> ver
-----------------------------------------------------------------------------------------
MATLAB Version: 23.2.0.2668659 (R2023b) Update 9
MATLAB License Number: STUDENT
Operating System: macOS Version: 14.4.1 Build: 23E224
Java Version: Java 1.8.0_392-b08 with Amazon.com Inc. OpenJDK 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------
MATLAB Version 23.2 (R2023b)
Image Processing Toolbox Version 23.2 (R2023b)
M2HTML Toolbox - A Documentation Generator for ... Version 1.4
Parallel Computing Toolbox Version 23.2 (R2023b)
Statistics and Machine Learning Toolbox Version 23.2 (R2023b)
Thank you!
6 Kommentare
Rahul
am 28 Okt. 2024
Bearbeitet: Rahul
am 28 Okt. 2024
@Wai Cheng, I am unable to reproduce the issue you have provided in MATLAB R2023b. The issue could be encountered if possibly some another function with name 'myparse' could be on MATLAB path, for which you can use the following command:
>> which myparse
If you find another function, you can try removing the undesired function from path manually, and in case you don't find the desired myparse file on path, you can add it using the following command:
>> addpath('path/to/your/desired/myparse.m')
You can try restarting your current MATLAB session.
The best practice here could be to rename the given function, since often MATLAB can check in folders with the same name as the function, which might not be installed.
To find the products, toolboxes and files required by a specific code or file, you can use the following function:
[~, products] = matlab.codetools.requiredFilesAndProducts('myparse.m');
disp(products.Name)
In your case, the products array contains a single element with name 'MATLAB' stating no requirement for 'Medical Imaging Toolbox'.
Antworten (4)
Tushar Sharma
am 28 Okt. 2024
Hi Wai,
It seems that the function you're trying to use, "myparse," may be causing conflicts in MATLAB. The error you're experiencing typically occurs when a function in your folder has the same name as a toolbox function for which you don't have a license. As a workaround, I suggest renaming your function.
To help identify name conflicts, although only for installed toolboxes, you might find this function useful: https://www.mathworks.com/matlabcentral/fileexchange/27861-uniquefuncnames
1 Kommentar
埃博拉酱
am 28 Okt. 2024
As @Tushar Sharma said, there's a naming conflict. However as @Rahul said, I also can't reproduce this issue. In my experience, MATLAB is generally able to handle the vast majority of naming conflicts correctly. If you don't want to change your function name, you can also try removing your folder from the search path and then adding it again.
It's a good practice for third-party toolboxes to use namespaces to avoid conflicts with official functions.
0 Kommentare
Rahul
am 28 Okt. 2024
Bearbeitet: Rahul
am 29 Okt. 2024
Hi Wai Cheng,
I understand that you are trying to execute a local function in MATLAB R2023b but getting an error stating “mpyarse requires Medical Imaging Toolbox”.
I am unable to reproduce the issue you have reported, in MATLAB R2023b. The issue could be encountered if possibly some another function with name 'myparse' could be on MATLAB path, for which you can use the following command:
>> which myparse
If you find another function, you can try removing the undesired function from path manually, and in case you don't find the desired myparse file on path, you can add it using the following command:
>> addpath('path/to/your/desired/myparse.m')
You can try restarting your current MATLAB session.
Although, the best practice here could be to rename the given function, since often MATLAB can check for conflicts in folders with the same name as the function, which might not be installed.
Moreover, to find the products, toolboxes and files required by a specific code or file, you can use the following function:
[~, products] = matlab.codetools.requiredFilesAndProducts('myparse.m');
disp(products.Name)
In your case, the products array contains a single element with name 'MATLAB' stating no requirement for 'Medical Imaging Toolbox'.
Hope this helps!
0 Kommentare
Walter Roberson
am 29 Okt. 2024
You could potentially have that problem if your setup function is adding the directory to the end of the MATLAB path instead of at the beginning of the MATLAB path.
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!