How do I write an if statement that says a variable is a error given a condition?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Temi O
el 7 de Feb. de 2019
Comentada: Kevin Phung
el 8 de Feb. de 2019
Please how do I write this 'if statement' in MATLAB notation? I ran a simulation N times and would like to find the error rate using an 'if statement'. I ran the simulation N number of times. How do I write that Y is an error if the statement below happens? And then calculate the errors in N number of trials?
if X=1.2||Y=0 && U1>U2
%How do I write that Y is an error if the above statement happens? And then calculate the number of errors in N number of trials?
end
10 comentarios
Kevin Phung
el 8 de Feb. de 2019
Did my answer below not give you an idea of how to increment the errorsCount?
Respuesta aceptada
Kevin Phung
el 7 de Feb. de 2019
%%outside forloop
errCnt = 0;
%% inside forloop
if X=1.2||Y=0 && U1>U2
%How do I write that Y is an error if the above statement happens?
disp(['Error found in iteration ' num2str(i)])
% And then calculate the number of errors in N number of trials?
errCnt = errCnt + 1;
end
%%
something like that. If you're looping through Y, dont forget to change it to Y(i)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Particle & Nuclear Physics en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!