how to create checkboxes in appdesigner based on number of specific files present in the folder?

조회 수: 2 (최근 30일)
I have couple of text files placed in current folder.The number of textfiles could be variable. I want appdesigner to create number of checkboxes corresponding to those text files having name same as those text files. How can I do that?

채택된 답변

Rik
Rik 2021년 12월 9일
You can create uicheckbox objects in a loop in your code, depending on a list of files.
See the documentation here.
  댓글 수: 2
Vinayak Untwale
Vinayak Untwale 2021년 12월 9일
Thanks Rik. Could you please explain a little bit more with example?
Rik
Rik 2021년 12월 9일
You can find more tips and advice here. The point is that you can create graphics objects with code.
n=1;
h(n)=uicheckbox('position',[10 10+100*n 50 100],...
'Text',sprintf('box %d',n),...
'parent',app.figure);
n=2;
h(2)=uicheckbox('position',[10 10+100*n 50 100],...
'Text',sprintf('box %d',n),...
'parent',app.figure);
You can probably see the pattern here. Unfortunately I can't run the code in the online environment, as uifigure is not supported.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by