Array indexing using App designer components
조회 수: 5 (최근 30일)
이전 댓글 표시
Hello Everyone,
Here is my current issue. What I would like to do is, using array indexing, identify and change color of a lamp in App Designer. In the code below I have an Index value (1-64) where im stuck is how to then take that value and idenify and specific lamp and change its properties. For example if Index = 32 then I would like app.lamp32 to change color to red.
Apologies if my explanation is less than exemplary, thank you for your help!
Guess=app.TargetCallout.Text % This will be one of the values in array C
C={'A1','A2', 'A3','A4' ,'A5' ,'A6','A7', 'A8', 'B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'C1', 'C2', 'C3', 'C4' ,'C5' ,'C6' ,'C7' ,'C8' ,'D1' ,'D2','D3','D4', 'D5', 'D6', 'D7', 'D8', 'E1', 'E2', 'E3', 'E4', 'E5', 'E6', 'E7', 'E8', 'F1', 'F2','F3' ,'F4' ,'F5' ,'F6' ,'F7' ,'F8' ,'G1' ,'G2', 'G3', 'G4', 'G5', 'G6', 'G7', 'G8', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'H7','H8'}
IndexC=strfind(C,Guess) % Change all array values to zero except the Guess location (which will be one)
Index=find(not(cellfun('isempty',IndexC))) % This specifies a number ie A1 would be Index= 1, H8 = 64
댓글 수: 1
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Identification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!