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

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');

 Réponse acceptée

Adam
Adam le 22 Sep 2014
Modifié(e) : Adam le 22 Sep 2014
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.

3 commentaires

Thank you for quick response. The idea is to use first function for processing adjustments (e.g. to find suitable rotation angle), whilst second one is required for main images processing. Error is still there: Reference to non-existent field 'angle'.
Please can you post the entire two functions in question, from their function signature down (with the above code included)?
I assume that error is being thrown on the:
angle=handles.angle;
line?
Problem is solved by adding new static text and using displayed value of angle. Now it works.
Thank you anyway!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by