MATLAB Answers

How to extract a app designer component from an array and change its properties

1 view (last 30 days)
Caleb Schindler
Caleb Schindler on 24 Mar 2020
I currently have an issue where I have a 1x64 array of app designer components (lamps) and I want to be able to index the matrix then change the color of the lamp however Im unsure how to alter the lamp color after extracting it from the matrix.
example
D=[app.A1, app.B2, app.C3]
Desired_Lamp=D(1,Desired_Column)

  0 Comments

Sign in to comment.

Answers (1)

Harsha Priya Daggubati
Harsha Priya Daggubati on 27 Mar 2020
Hi,
I guess you can use Property Inspector to know the properites of any variable present in the workspace. If it has any properties you can refer using '.' . I think it should go well. If not, can you share these variables so that I can investigate the issue with more clarity.

  2 Comments

Caleb Schindler
Caleb Schindler on 6 Apr 2020
Hello,
Here's my issue in more depth/ with the attached code. What I want to do in the end would be to change the color of a lamp based on the Guess value. In the attached code I have managed to specify an Index value (1-64) corrisponding to what position in array C my Guess value is in. Where im stuck is how to then associate that Index value with a lamp component then change its color.
Thanks for you help!
Guess=app.TargetCallout.Text
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)
Index=find(not(cellfun('isempty',IndexC))) % This specifies a number ie A1 would be Index= 1, H8 = 64
Harsha Priya Daggubati
Harsha Priya Daggubati on 7 Apr 2020
Hi,
I understood you want to change Color property of your Lamp component using Index.But, It is very difficult to guess to guess what Lamp component would be and its properties are. It would help if you can share your Lamp component.

Sign in to comment.

Products


Release

R2019b