How to make a valid array for boxplots?
2 views (last 30 days)
Show older comments
Hello, I am trying to make a boxplot in MATLAB using imported Excel data. I have the two columns of data I wish to plot, both are a cell arrays, one called Juice_type which has names such as 'Orange', 'Apple', 'Kiwi' (297x1). The other is numerical data, titled Area_Glu2(297x1). When I run the script it gives me the error 'Input (x) does not appear to be a valid array.'. My end goal is to have a boxplot with the 6 different Groups in Juice_type on the xaxis and the Areas on yaxis. I am a relatively new user to MATLAB and might be missing a key line that may solve this Problem. I am wondering how to make the c3 variable a valid Array to plot.
Here is my script:
%%Define Elements
c1 = Area_Glu2 ; %A 297x1 cell
c2 = Juice_type; %A 297x1 cell
c3 = ([c2, c1]); %Makes a 297x2 Cell array
boxplot(c3);
Edit: Here is my script from the first attempt. The data is all the same cell arrays. Maybe this one is easier to fix? It outputs a boxplot but I Need to edit it, such as boxstyle and colouring but it gives me a structure error when I try to add Name/Value additions such as 'BoxStyle', 'filling'
boxplot(Asp, juice_type1);
title('Amino Acid Juice Composition');
xlabel('Juice type');
ylabel('Asp (concentration)');
ylim([-100 2500]);
0 Comments
Answers (1)
See Also
Categories
Find more on Axis Labels 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!