I'm keep getting " index exceeds matrix dimension"

조회 수: 2 (최근 30일)
Shira Arluk
Shira Arluk 2019년 12월 15일
편집: Shira Arluk 2019년 12월 15일
hey, I'm very new to matlab. We got an assignment to plot some data about ratings of cities in the USA, in 9 different catagories. (it is a famous data in MATLAB).
This is the assignment-
"Plot all the data for each city under one figure and add a legend containing category names. Use the xlabel, xlim, title, legend functions."
this is my code and the figure seems to come out right but i keep getting this warning- "In legend (line 118)
Index exceeds matrix dimensions."
r = figure(3);
hold on
for i= 1:size(names,1)
plot(ratings(:,i))
title('cities rankings by categories');
legend('climate','housing','health','crime','transportation','education','arts','recreation','economics');
xlabel('City ID');
xlim([0 329]);
end
I don't know what's the problem..cause I do get the figure.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Title에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by