Warning: Ignoring extra legend entries. How do I fix this?
Mostra commenti meno recenti
Hello all, I am using a for loop to form a matrix based on user inputs. It works how I want it when there is more than 1 iterations; however, whenever I only use 1 iteration it gives me an error during the graphing section.
clc
clear
close all
%this is an example similar to my code
n = input('how many iterations ');
update = [[],[],[],[],[]];
for k = 1:1:n
input1 = input('input number ');
input2 = input('input number ');
input3 = input('input number ');
input4 = input('input number ');
update = [update; n, input1, input2, input3, input4]
end
ngraph = update(:,[3,5]);
hold on
bar( ngraph, 'grouped' )
hold off
drawnow
xticks( 1:1:n )
ylabel( 'height' )
xlabel('distance')
[MIN, mL] = min(ngraph(:,2));
[MAX, ML] = max(ngraph(:,2));
ylim([0 (MAX+25)])
text(mL,MIN,'Low', 'HorizontalAlignment','left','VerticalAlignment','top')
text(ML,MAX,'High','HorizontalAlignment', 'left', 'VerticalAlignment', 'top')
legend('professionals' ,'kids')
Because when I type update(:,[3,5]) in the command window, it clearly shows 2 values. So i'm confused why it's saying "Warning: Ignoring extra legend entries."
I appreciate any help, thank you.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Creating and Concatenating Matrices in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





