我的意思是你文件能不能用load读取成功,看来是没有的,又或者是变量名并不是shuju,在load代码前面加上clear,将断点放在g = graph(shuju(:,1), shuju(:,2));查看工作区内容的方式来查看文件内容。
matlab导入数据,运行代码出错。
15 次查看(过去 30 天)
显示 更早的评论
我把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 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!