Error in graphplot Function (Econometrics Toolbox - DTMC)
3 次查看(过去 30 天)
显示 更早的评论
Hi, I have been working with discrete time Markov models for the past month or so, and everything has worked fine up until now. I have been using the graphplot function to visually display the transition states and it worked in the past, but now I am getting a string of errors unrelated to anything in my code. I made a new test file and cleared all of my variables to see if it would run, and I received the same errors. Here is my test code (starting from cleared variables):
p1 = [0.01, 0.5, 0.002;
0.02, 0.001, 0.05;
0.1, 0.4, 0.2]
mc1 = dtmc(p1, "StateNames", ["1", "2", "3"])
gr1 = graphplot(mc1); % this line triggers the errors
This is the most basic information that you would need to run the functions. I had no issues with this 5 days ago, I tried restarting Matlab to no avail. The only thing that has changed between when the code worked and now is that the code path was moved to a new file. If anyone has any idea as to what's going on I would appreciate any help.
Thanks.
errors:
Error using rng
Too many input arguments.
oldstate = rng(0,'twister');
[x,y] = layoutOneConnComp(x,y,sources,targets,1,gForce,doGravity,iterations);
Error in matlab.graphics.chart.primitive.GraphPlot/layoutforce
Error in matlab.graphics.chart.primitive.GraphPlot/layout>layoutauto
Error in matlab.graphics.chart.primitive.GraphPlot/layout
Error in matlab.graphics.chart.primitive.GraphPlot
hObj = matlab.graphics.chart.primitive.GraphPlot('BasicGraph', ...
hPlot = plot(ax,graph,...
basicPlot(G)
回答(1 个)
Steven Lord
2023-6-27
I'm guessing you wrote or installed a file named rng.m that's taking precedence over the rng function included as part of MATLAB. To check this, please show us what this command displays:
which -all rng
If you see a different rng.m (relative to the matlabroot directory which on Linux is /MATLAB/, the MATLAB root directory will be different if you're on Windows) you probably want to rename it or move the directory containing it lower on your MATLAB path (or off the path entirely.) If this is part of a collection of functions or a third-party toolbox that you downloaded you may want to report this conflict to the author of the rng.m file.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graph and Network Algorithms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!