Same code I can successfully run in R2021b but in R2016a it is showing Error using - Matrix dimensions must agree. What should I change to run this in R2016a?
Mostrar comentarios más antiguos
function [facilities,R,Dij,E,C]=a(r1,r2,d1,d2,i,j)tic
facilities=(1:i)';
R = randi([r1 r2],[i 2]);
R(:,2)=(R(:,1))+(R(:,2));
Dij=randi([d1 d2],[i,j]);
E=zeros(i,1);
E(:)=10^-6;
for m=1:i
for n=1:j
C = max((R(:,2)-Dij(:,:)),0)./max(max((R(:,2)-R(:,1)),(R(:,2)-Dij(:,:))),E(:,1));
n=n+1;
end
m=m+1;
end
toc
end
% Same code I can successfully run in R2021b but in R2016a it is showing Error using - Matrix dimensions must agree. What should I change to run this in R2016a?
3 comentarios
Jiri Hajek
el 8 de Dic. de 2022
Hi, Matlab has given you much clearer indication about the error, but you have not posted it here, as well as data to reproduce your error.
- At which line of code the error occured?
- What was the value of variables entering the expression on that line?
Sourasis Chattopadhyay
el 8 de Dic. de 2022
You can read more about implicit array expansion here:
The code throws an error on R2016a because it does not have implicit expansion.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!