Borrar filtros
Borrar filtros

Subplots and thier Position (Expert needed)

1 visualización (últimos 30 días)
Max Müller
Max Müller el 10 de Jul. de 2014
Comentada: Max Müller el 11 de Jul. de 2014
somebody before me has writen this code and now I need to optimize it.But I dont get it. This Code creats Ncam(most times 9) plots in a figure......I already lost my mind.
e.g. isn't 2+1 = 3 ?
If u are reading this: pls tell my ur Thoughts on this code. Thanks
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
for i = 1:Ncam
rows = 2;
cols = round(Ncam)/2+1;
bound = 0.045;
width = (1/rows)-(bound*1.4);
height = (1/cols)-(bound*1.5);
subplot('position',[(bound+(mod(i-1,2)/rows)) (bound+((floor(((Ncam-i+1)+1)/2)-1)/cols)) width height])
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Respuesta aceptada

Mischa Kim
Mischa Kim el 10 de Jul. de 2014
Max, are you referring to
cols = round(Ncam)/2+1;
(I believe not)? If so, the code first divides by 2 and then adds 1 to the result. As opposed to
cols = round(Ncam)/(2+1); % note the brackets
In other words, what and where exactly is the problem? What do you want the code to do?
  1 comentario
Max Müller
Max Müller el 11 de Jul. de 2014
that was very stupid. Of curse its not 3...... yesterday was not my day. Thanks a lot. I got the solution now.....
have a nice day.
PS: Send me an OK, so i can remove the question.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by