Well, . . . they're both bad. the first set of code calls the image array axes1 and axes2 - the same name that you're calling the axes. While this won't give an error it is confusing and bad practice. You should call them grayImage or rgbImage or some other descriptive name that's not the name of one of your GUI controls. You can use the same name in both functions since you seem to be keeping the image just as a local variable, local to that function and it vanishes when that function exits.
The second set of bad code overwrites the built in image() function by calling the image array "image" - again, very very bad practice. You never want to choose a variable name that is the same name as one of the built in functions.
But the reason for the error is this expression:
handles is a structure. It does not have a structure member (field) called "axes", much less one that is a cell array. If you were to want to do it that way, you'd have to use dynamic structure names, but that is complicated and confusing. If you have only a handful of axes to populate with images, then I'd recommend just setting the current axes with the axes() function, or with the 'parent' option of imshow(). If you will really have some variable number of axes, like dozens, then I'd recommend you create them on the fly with uicontrol() and get the handles into an array. Then you could index them in a loop.
Best Answer