Hello,
I am using app designer to import data from a csv file an plot curves, based on the data from the file, in UIAxes. I'd like to implemet the function to change the colour of each curve. Therfore, I use a drop down field, filled with 8 different colours. These colours are defined in the private properties area (RGB values).
LightBlue = [0.3010 0.7450 0.9330]; DarkBlue = [0 0.4470 0.7410]; LightRed = [0.8500 0.3250 0.0980]; DarkRed = [0.6350 0.0780 0.1840]; Yellow = [0.9290 0.6940 0.1250]; Purple = [0.4940 0.1840 0.5560]; Green = [0.4660 0.6740 0.1880]; Black = [0 0 0];
After changing the dropdownfield-value, the user has to confirm his changes. To use a short code, I want to create a while-loop:
A = [app.ColourDropDown_1.Value app.ColourDropDown_2.Value app.ColourDropDown_3.Value app.ColourDropDown_4.Value app.ColourDropDown_5.Value app.ColourDropDown_6.Value app.ColourDropDown_7.Value app.ColourDropDown_7.Value]; B = [app.ColourCurve1 app.ColourCurve2 app.ColourCurve3 app.ColourCurve4 app.ColourCurve5 app.ColourCurve6 app.ColourCurve7 app.ColourCurve8]; C = 1; while C<9 switch A(1,C) case 'Light blue' B(1,C) = app.LightBlue; case 'Dark blue' B(1,C) = app.DarkBlue; case 'Light Red' B(1,C) = app.LightRed; case 'Dark Red' B(1,C) = app.DarkRed; case 'Yellow' B(1,C) = app.Yellow; case 'Purple' B(1,C) = app.Purple; case 'Green' B(1,C) = app.Green; case 'Black' B(1,C) = app.Black; end C = C+1; end
In the first iteration, the code should take the first value of matrix A (drop down field value). Then, it should take the first value from matrix B and allocate the colour-value.
Does anyone know a way to do that? I know the problem in my code, but is there another way than do the switch-case code for every chanel?
Thank you very much!
Best Answer