MATLAB: How can refer to rotational angle, which was made in another function of GUI

angleimage analysisimage processingmatlab guirotation

Hi, I want to use obtained rotation angle for further computing in another function. Assignment of angle to handles.angle did not help.
———-
handles.angle = round( get(hObject,'Value') );
Im_r = imrotate(handles.pic, handles.angle, 'bilinear', 'crop');
———-
angle=handles.angle;
I_r = imrotate(I,angle, 'bilinear', 'crop');

Best Answer

The first code section looks like it should work fine, but you need to add
guidata( hObject, handles )
at the end of the function containing that code in order for your 'angle' field to be added to the GUI's 'handles' structure rather than going out of scope in a copy of 'handles' that is local to your first function.