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

1 view (last 30 days)
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');

Accepted Answer

Adam
Adam on 22 Sep 2014
Edited: Adam on 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 Comments
Adam
Adam on 22 Sep 2014
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?
Vladimir
Vladimir on 22 Sep 2014
Problem is solved by adding new static text and using displayed value of angle. Now it works.
Thank you anyway!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!