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!