matlab导入数据,运行代码出错。
16 views (last 30 days)
Show older comments
我把excel的数据转换成mat文件格式,然后出现以下问题
函数或变量 'shuju' 无法识别。
出错 MLplots (第 14 行)
G = graph(shuju(:,1), shuju(:,2));
以下是我的代码
load('shuju'); %Load data
g = graph(shuju(:,1), shuju(:,2));
lb = 0.0; %Upper and lower bounds for alpha
ub = 1.0;
[D, DD] = arrayfun(@(a) ... %Apply MLmodel to alpha values.
MLmodel(g,a, 1:10), linspace(lb,ub,11));
figure; %Plot Damage versus alpha.
plot(linspace(lb,ub,11), D, linspace(lb,ub,11), DD)
legend('D', 'D^{\prime}')
title('I. Damage versus \alpha Values (First 50 Node Failure)')
xlabel('\alpha Value')
ylabel('Damage')
0 Comments
Accepted Answer
locefaa
on 30 Mar 2023
我的意思是你文件能不能用load读取成功,看来是没有的,又或者是变量名并不是shuju,在load代码前面加上clear,将断点放在g = graph(shuju(:,1), shuju(:,2));查看工作区内容的方式来查看文件内容。
0 Comments
More Answers (0)
See Also
Categories
Find more on MATLAB Report Generator in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!