Execution of script digraph as a function is not supported: C:\Softwar​e\Mathwork​s\Matlab_A​ll_Product​s_R2021b\t​oolbox\mat​lab\graphf​un\@digrap​h\digraph.​magr

1 次查看(过去 30 天)
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 个评论
Stephen23
Stephen23 2023-11-17
"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.

请先登录,再进行评论。

回答(1 个)

Nihal
Nihal 2023-11-17
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:
  1. 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.
  2. 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.
  3. 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.
  4. 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.

类别

Help CenterFile Exchange 中查找有关 Networks 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by