필터 지우기
필터 지우기

Problem with checkbox in Gui

조회 수: 9 (최근 30일)
faran
faran 2018년 7월 11일
댓글: Walter Roberson 2021년 8월 12일
Hi,
I am creating a GUI that is having checkbox. I used the uicheckbox since everytime that I am running the gui the number of checkboxes will be changed. The program first read from a csv file and according to the rows in the csv file, the checkbox will be created so that user can choose from these checkboxes.
The problem is that when I am running the program out of gui it is working perfect and the checkbox is a matlab.ui.control.checkbox. But when I am using it inside the gui, it will be a double and I can not find which ones user selected.
Can anyone help??
  댓글 수: 9
Walter Roberson
Walter Roberson 2018년 7월 11일
Inside the gui: is it possible the GUI is App Designer based?
... I think we are going to need the GUI code (and any .fig) to test with.
faran
faran 2018년 7월 11일
Here is a smaller version of the gui. When you generate it and check the output you will see it is a matrix while if you just run the codes out of gui you will see that output is a matlab.ui.control.checkbox.

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

답변 (1개)

Walter Roberson
Walter Roberson 2018년 7월 11일
In testgui_OpeningFcn add the lines
global Target_checkbox
Target_checkbox = gobjects(0);
What is happening is that you are not initializing Target_checkbox, so by default it is initialized to [] which is a numeric array. When you assign a graphics handle into a double array, it automatically converts it to the old-style numeric handles.
  댓글 수: 6
Devante Kerr
Devante Kerr 2021년 8월 12일
Do you know if this samemethod would work for a property?
Walter Roberson
Walter Roberson 2021년 8월 12일
Initializing to gobjects() would be useful for a property that will eventually be a graphics object.

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

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by