- Put the code in a function.
- Use conditional breakpoints
debugging a program
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
som
el 6 de Abr. de 2012
Editada: per isakson
el 30 de Sept. de 2014
Hi all; I've written a program including two loops and I want to debug it using "keyboard " command.
for n=1:1000
for qq=1:100
tsd (n,qq)= rand(1);
keyboard
end
end
I want to see the "tsd " values just in "n=10 " and "qq=50, 70; 89" . How can I do this using "keyboard" and "return" commands. I look forward to see your reply,
0 comentarios
Respuesta aceptada
per isakson
el 6 de Abr. de 2012
Editada: per isakson
el 2 de Mzo. de 2014
Why do you want to use KEYBOARD? That's not the best way - in my opinion. Thus, I would:
However, try to replace the line "keyboard" by
if n==10 && ( qq==50 || qq==70 || qq==89 )
keyboard
end
0 comentarios
Más respuestas (2)
Alex
el 30 de Sept. de 2014
Editada: per isakson
el 30 de Sept. de 2014
How do i fix this?
for i = 1:x_max
for i = 1:y_max
if(forests(i,j) == 1) %Plot Green grass
rectangle ('position',[i-0.5,j-0.5,MapRes,MapRez],'FaceColor',ForColor)
hold on
end
getting this error
if(forests(i,j) == 1) %Plot Green grass
1 comentario
Alex
el 30 de Sept. de 2014
sorry this is the error: Subscript indices must either be real positive integers or logicals.
Ver también
Categorías
Más información sobre Desktop 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!