Execution of script digraph as a function is not supported: C:\Software\Mathworks\Matlab_All_Products_R2021b\toolbox\matlab\graphfun\@digraph\digraph.magr
5 views (last 30 days)
Show older comments
Hi,
I am getting an error while using digraph function. I checked the script of digraph it does not contain any function but, one of my code. How to solve this issue. Where can I get function file.
Execution of script digraph as a function is not supported:
C:\Software\Mathworks\Matlab_All_Products_R2021b\toolbox\matlab\graphfun\@digraph\digraph.m
Thank you
1 Comment
Stephen23
on 17 Nov 2023
"I am getting an error while using digraph function. I checked the script of digraph it does not contain any function but, one of my code."
It looks like you have (accidentally?) modified the DIGRAPH function. Sometimes users do this when they open a MATLAB function, type some characters at the start without noticing, and then get prompted to save the modified function. Other users make changes intentionally... and then regret them very soon afterwards.
"How to solve this issue. Where can I get function file."
Use your OS backups (if enabled) or reinstall MATLAB.
Answers (1)
Nihal
on 17 Nov 2023
Hi Srushti,
I understand that you are facing issue with the digraph function in MATLAB. The error message you're seeing suggests that MATLAB is trying to execute the script digraph as a function, which is not supported. This can happen if there's a naming conflict between the script and the function.
The digraph function is part of the MATLAB's Graph Theory functions, and it's used to create directed graphs. If you have a script in your current directory or on your MATLAB path named digraph.m, MATLAB might be trying to run that script instead of the built-in digraph function.
Here are a few things you can try to resolve this issue:
- Check for Naming Conflicts: Use the which command to see if there's a naming conflict. Type which digraph -all into the MATLAB command window and press Enter. This will show all the files named digraph on your MATLAB path. If there's a file named digraph.m in your current directory or elsewhere on your MATLAB path, you might need to rename it to avoid the conflict.
- Change the Current Directory: If the problematic digraph.m file is in your current directory, try changing to a different directory and then call the digraph function again.
- Remove the Problematic File from the MATLAB Path: If the digraph.m file is elsewhere on your MATLAB path, you might need to remove it from the path. You can do this using the rmpath function.
- Reinstall MATLAB: If none of the above solutions work, there might be an issue with your MATLAB installation. In this case, you might need to reinstall MATLAB.
If you continue to have problems, I recommend contacting MathWorks support. I hope it helped.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!