Filter löschen
Filter löschen

Subplots and thier Position (Expert needed)

1 Ansicht (letzte 30 Tage)
Max Müller
Max Müller am 10 Jul. 2014
Kommentiert: Max Müller am 11 Jul. 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])
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Akzeptierte Antwort

Mischa Kim
Mischa Kim am 10 Jul. 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 Kommentar
Max Müller
Max Müller am 11 Jul. 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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by