Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Why in the for cycle the values of the first row of the matrix y(i,j) don't exist?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi all,
i'm trying to understand why the first row of the matrix "y(i,j) " isn't considered in my expression "FUNCTIONALITY13". If i run the program, "FUNCTIONALITY13" takes only the values of the last row of "y(i,j)", that is "i=2" .
This is my matrix (as you can see in the code): y(i,j)=[3 5 9; 2 4 8]. FUNCTIONALITY13 takes only the values that corrispond to "state_sys(2,j)" and all the values "state_sys(1,j)" are not taken. Someone could tell me why? How can i do so that FUNCTIONALITY13 takes all values of the matrix "y(i,j)"?
TIMEFAILUREPUM5=[4 6 10];
for j=1:length(TIMEFAILUREPUM5)
for i=1:2
y(i,j)=TIMEFAILUREPUM5(1,j)-i;
if t==(TIMEFAILUREPUM5(1,j)) &&(state_sys(y(i,j))==9||...
state_sys(y(i,j))==10|| state_sys(y(i,j))==11||state_sys(y(i,j))==12)
FUNCTIONALITY13=max(0, FUN13(t-1)-1);
else
FUNCTIONALITY13=min(1,FUN13(t-1));
end
end
end
Thanks to who will help me.
0 comentarios
Respuestas (1)
Shubham Gupta
el 24 de Sept. de 2019
I think FUNCTIONALITY13 is being updated after each i, so FUNCTIONALITY13 is not storing all the values as matrix.
You might wanna change the "if...else" loop by
if t==(TIMEFAILUREPUM5(1,j)) &&(state_sys(y(i,j))==9||...
state_sys(y(i,j))==10|| state_sys(y(i,j))==11||state_sys(y(i,j))==12)
FUNCTIONALITY13(i)=max(0, FUN13(t-1)-1);
else
FUNCTIONALITY13(i)=min(1,FUN13(t-1));
end
I hope it helps !
1 comentario
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!