How do I get my string from a handle.text GUI HELP

I'm trying to obtain a string value and set it as a variable 'a' ..
So in the opening function I set a particular handles.text to 'TRUE'. One pushbutton sets handle.text to 'FALSE', but I want to be able to read if that value is true or false to stop a loop.
I tried to set them as integers, but Matlab didn't allow me to? For example
set(handles.text, 'String', 'TRUE')
works fine.. but if I try
set(handles.text, 'double', 0)
i'm told it's an invalid property.. is there a property for integers? if not can I read out my text as a separate variable 'a'?

 채택된 답변

Image Analyst
Image Analyst 2013년 2월 11일

0 개 추천

No there is no "double" property for text label controls. Perhaps you want to use the UserData property to store things.

댓글 수: 7

Amed
Amed 2013년 2월 11일
How would I go about using that? i'm new, sorry.
Ok so if I use..
set(handles.text11, 'Userdata', 0);
in the opening function, and later call a pushbutton to perform
a = get(handles.text11)
I get a long line of details about a, no numerical value..
Amed
Amed 2013년 2월 11일
anybody.....?
Amed
Amed 2013년 2월 11일
...
We don't really know what you want to do. Why don't you just have a global variable to keep track of your variables? How about getappdata() and setappdata()? Or keep this boolean variable in a checkbox or a pair of radio buttons?
Amed
Amed 2013년 2월 11일
i'm trying to set text as some sort of string data, and then compare it in an if statement.. if that text handle is true, do this, if false, do that. but I cannot get the data from the text handle.
Amed
Amed 2013년 2월 11일
THANKS SOLVED!

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

추가 답변 (1개)

ChristianW
ChristianW 2013년 2월 11일

0 개 추천

Get String from text handle:
get(handles.text,'String')
Checking and breaking a loop:
if strcmp(get(handles.text,'String'),'FALSE')
return
end

카테고리

도움말 센터File Exchange에서 Variables에 대해 자세히 알아보기

질문:

2013년 2월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by