Hello. Could anyone help me? I keep getting "Index exceeds matrix dimensions."
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Error in data_inductor23 (line 70)
max_ipc = max_ipc + (tw_max - DM(i+1,3))*Tool_Power(b(j))*0.1;
.
tw_max = 40; %tw_max = time window max
Tool_Power=[100;120;1500;2800];
n=length(DM(:,1));
min_dc = length(unique(DM(:,1))) - 1;
max_dc = n - 1;
min_tc = length(nonzeros(unique(DM(:,3:end)))) - 1;
max_tc = 0;
for i = 1:n-1
a=length(nonzeros(DM(i,3:end)));
b=length(nonzeros(DM(i+1,3:end)));
max_tc = max_tc + (a.*b);
end
max_ipc = 0;
for i = 1:n
a=length(nonzeros(DM(i,3:end)));
b=nonzeros(DM(i,3:end));
for j = 1:a
max_ipc = max_ipc + (tw_max - DM(i+1,3))*Tool_Power(b(j))*0.1;
end
end
max_ip = max_ipc/3600;
4 commentaires
Réponses (1)
Walter Roberson
le 22 Mai 2018
Your DM has non-zero values as large as 14 in columns 3 to end. Those become your b values. You use b(j) to index Tool_Power, but Tool_Power is only length 4.
1 commentaire
per isakson
le 22 Mai 2018
Matlab R2016a says:
Index exceeds matrix dimensions.
Error in cssm (line 45)
max_ipc = max_ipc + (tw_max - DM(i+1,3))*Tool_Power(b(j))*0.1;
Why isn't Matlab more helpful and tells the user which variable and which values of which indicies are involved?
Voir également
Catégories
En savoir plus sur Logical 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!