global variable not working in all fonctions.
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello everyone, I have a global variable which is not always well evaluated in the subfonctions that I have. in the main I 'm creating a GUI with buttons etc...and I when I click on the buttons I call the subfunctions (event).
in the main functions the global variable = a char
When I call the first time a subfunction by pushing a button, the global receive the same char. And if I click in another Button (I call another function), in the declaration the global variable became a double empty.
댓글 수: 0
답변 (1개)
Azzi Abdelmalek
2012년 7월 18일
편집: Walter Roberson
2012년 7월 20일
%have you set those variables Global in all subfunction that use those variables?
%instead using global variables, why don't you save your variable "v" in any of your object "exemple: %object1"
set(handles.object1,'Userdata',v) %v can be array, string, ....
%to get your variable ue
get(handles.object1,'Userdata')
댓글 수: 2
Jan
2012년 7월 20일
Instead of using the UserData, you can store the value inside the handles struct duirectly also. See "help guidata".
참고 항목
카테고리
Help Center 및 File Exchange에서 Whos에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!