Exceeds the number of array elements (0).
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi everyone,
I have got the error in the code below, What should I do to fix it?
Code
% convert finite values to indices between 1 and map length
n = size(map, 1);
inds = (img(valid)-bounds(1))/(bounds(end)-bounds(1))*(n-1);
inds = floor(min(max(inds, 0), n-1))+1;
Error
Index exceeds the number of array elements (0).
Error in double2rgb (line 44)
ins = (img(valid)-bounds(1))/(bounds(end)-bounds(1))*(n-1);
0 commentaires
Réponse acceptée
Voss
le 24 Jan 2023
Either img or bounds (or both) is empty.
Check img and bounds and figure out why one or both is not what you expect.
9 commentaires
Voss
le 7 Fév 2023
Modifié(e) : Voss
le 7 Fév 2023
My guess is that wij(ll) is NaN or Inf or a non-positive number.
You can see below that those cases throw the error you got:
try
line([1 2],[1 2],'LineWidth',NaN)
catch e
delete(gca())
disp(e.message);
end
try
line([1 2],[1 2],'LineWidth',Inf)
catch e
delete(gca())
disp(e.message);
end
try
line([1 2],[1 2],'LineWidth',0)
catch e
delete(gca())
disp(e.message);
end
try
line([1 2],[1 2],'LineWidth',-1)
catch e
delete(gca())
disp(e.message);
end
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Line Plots 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!