Converting rad to deg in a static text box GUI?

I have a edit text box which the user will put the radians in, then i want the static text box to the side of it to show the value in degrees automatically. I have tried:
set(handles.text6_camberdeg,'String',angledim((get(handles.edit4_camberrad,'String')),'radians','degrees'));
my edit text box is tagged: edit4_camberrad my static text box is tagged: text6_camberdeg

 채택된 답변

Matt Fig
Matt Fig 2012년 8월 21일
편집: Matt Fig 2012년 8월 21일

0 개 추천

The problem is that you are passing ANGLEDIM a string and expecting a string output. It takes and returns doubles, not strings.
D = str2double(get(handles.edit4_camberrad,'String'))*180/pi;
set(handles.text6_camberdeg,'String',num2str(D));

댓글 수: 1

Krystina
Krystina 2012년 8월 21일
Hi Matt,thanks for that. I'd tried that str2double before but couldn't get it to work because of the string reason :)
It's now working, only i cant seperate it from the previous function coding above and so its calling the input in a differnt text box. How do i seperate this?
Cheers

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품

질문:

2012년 8월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by