Passing an axes handlle to a function

I have created a function in which I want to be able to take an image from an axes1 component and redraw on another axes component...with this target axes component being passed as n argument. This is my attempt:
The function:
function rescaleImage(handles,str)
%Get image on axes1
axes(handles.axes1)
image1=getimage(handles.axes1);
%Create handle for new placement of image
%Use str argument to pass the axes handle.
str2func(str)
imshow(image1,[])
Calling the function to redraw the image onto axes3.
rescaleImage(handles,'handles.axes3')
There is no error message, but the image does not redraw on axes3.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 19 de Oct. de 2015
function rescaleImage(handles,str)
%Get image on axes1
axes(handles.axes1)
image1 = getimage(handles.axes1);
%Create handle for new placement of image
%Use str argument to pass the axes handle
imshow(image1,[], 'Parent', handles.(str))
and instead of passing 'handles.axes3' pass 'axes3'

Más respuestas (0)

Categorías

Preguntada:

el 19 de Oct. de 2015

Comentada:

el 19 de Oct. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by