What does this error mean: "Assigning to 3 elements using a simple assignment statement is not supported. Consider using comma-separated list assignment." How to remove?
Show older comments
I am trying to create a clustered bar graph from this data.
times = [5,20,40,60,120];
ravgdm =
35.3689 34.2453 31.9268 29.3701 33.5380
30.4708 32.3411 28.3500 27.8087 28.9000
19.7406 21.9029 20.6332 18.9298 20.4248
My code looks like this.
figure()
times = [5,20,40,60,120];
bcv = bar(times,ravgdm)
bcv.FaceColor = 'flat';
bcv.CData(1,:) = [0.9290, 0.6940, 0.1250];
bcv.CData(2,:) = [0.4940, 0.1840, 0.5560];
bcv.CData(3,:) = [0.9, 0.1, 0.1];
set(gca, 'XTickLabel', {'5','20','40','60', '120'})
xlabel ('Time (min)')
ylabel ('Average Diameter (pixels)')
title ('Average Diameter (pixels) at Each Time Point')
However, I keep getting theses errors, and I dont know why.
Assigning to 3 elements using a simple assignment statement is not supported. Consider using
comma-separated list assignment.
Error in csize (line 64)
bcv.FaceColor = 'flat';
Some insight on why this is occuring would be great! Thank you!
2 Comments
I have a related issue.
a = [10;2;0;0;0;2;6;7];
b = [0;8;1;0;0;4;2;3];
c = [0;0;9;10;10;4;2;0];
x = [2; 2.5; 3; 3.5; 3.75; 4; 4.5; 5];
r1 = ribbon(x, [a b c]);
This gives me 3 ribbons.
I want to change the appearence of all the 3 together. For example, I want the FaceAlpha to be 0.5
I can do this:
r1(1).FaceAlpha = 0.5
r1(2).FaceAlpha = 0.5
If I write
r1(1:3).FaceAlpha = 0.5
I get this error:
Assigning to 3 elements using a simple assignment statement is not supported. Consider using comma-separated list assignment.
What is the right way to access all the ribbons together?
[r1.FaceAlpha] = deal(0.5);
Or, specifically for setting graphics objects' properties:
set(r1,'FaceAlpha',0.5);
Accepted Answer
More Answers (0)
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
