can i use more than one hold on function in same code?

2 views (last 30 days)
I am dividing an image in four quadrants recursively if they satisfy the condition. For that I am using following code:
function div_rec_A( lf,rf,r,c,g1_squ,g2_squ )
hold on;
if condition
%copy the part in another image
lf = AL;
rf = AR;
[r c] = size(lf);
g1_squ = AFL;
g2_squ = AFR;
here lf and rf are two images, r and c are dimension of the image and g1_squ and g2_squ are gradient of the lf and rf respectively. AL and RL is image portion of first quadrant of lf and rf images respectively. And AFL and AFR is image portion of first quadrant of g1_squ and g2_squ images respectively.
The above code works well and divides the first quadrant of the image but now I want to divide image of all four quadrants. So I made other three same functions namely div_rec_B(lf,rf,r,c,g1_squ,g2_squ), div_rec_C(lf,rf,r,c,g1_squ,g2_squ), div_rec_D(lf,rf,r,c,g1_squ,g2_squ) because the conditions are different for each quadrant. And all four functions are called in main function sequentially.
The problem is, the division of only first function is displayed. I tried adding
in each function at starting. It shows the result but I want all the divisions to be done on single image. So I guess the hold on function is not holding the image after first function. I didn’t write hold off in any of the function.
I hope the problem is clear. Plz HELP. Thanks in advance.

Sign in to comment.

Answers (1)

Ingrid on 3 Mar 2015
the question is not completly clear (it helps if you would use the code lay-out option so that is better parsed), but it does not seem to make sense to use the hold on option in this case since you only have one image it seems and thus only one axes...
did you try stepping trhough your code to make sure that xv1 and yv1 are calculated correctly for the other quadrants. It could be that the offset is ill-defined causing the lines to be drawn, but not visible to you because outside of visible range.
Disha on 5 Mar 2015
thank you for making me realize that there is problem with the recursion function only. actually I am passing size of the image. so every time it will take from 1 to 128 if my image size is 256*256.
is there any other way i can pass parameters so that the lines can be drawn as i previously showed.
the other function code is same as first. the only change is in the condition. so xv1,yv1,xh1 and yh1 are same for all.
thanks in advance

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!