matlab导入数据,运行代码出错。
17 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
我把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 commentaires
Réponse acceptée
locefaa
le 30 Mar 2023
我的意思是你文件能不能用load读取成功,看来是没有的,又或者是变量名并不是shuju,在load代码前面加上clear,将断点放在g = graph(shuju(:,1), shuju(:,2));查看工作区内容的方式来查看文件内容。
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur MATLAB Report Generator dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!