MATLAB: What is the wrong with parent property of image object

image objectparent

I have an image object and I want to show it in a definite axes. So have a script as below:
ax=axes
a=round(100*rnd(50))
img=image(a)
set(img,'parent',ax)
MATLAB gives an error as; invalid object handle.
I can not understand where I did wrong

Best Answer

Works for me if I test the code as given, except with "rnd" changed to "rand"