how can i debug this error for my code ?? Error using ==> plot Data may not have more than 2 dimensions

4 views (last 30 days)
hi friends, i am trying to run this code each time, i am getting error like ??? Error using ==> plot Data may not have more than 2 dimensions please help me to debug this error.
subplot(2,2,1)
p=plot(k,Tot_Fairness_out,'-',k,average_Tot_fairness_out,'m-o');
% fairness for outer loop
set(p, 'LineWidth',2.5)
ylabel('LBE1+LBE2')
title('Jain`s total fairness index/10runs')
xlabel('(a) Number of runs')
legend('Index', 'Average (10 runs)')%
grid on
subplot(2,2,2)
p= plot(q,FI, '-+', q,Tot_Fairness_inner, 'g-^' );
set(p, 'LineWidth',2.5)
xlim([3 33])
title({'Jain`s fairness index/10 competitions'})
ylabel('LBE1+LBE2')
xlabel(' (b) q1 values for LBE-UE1')
legend('FI', 'Average (10 comp.)')
grid on
  1 Comment
Walter Roberson
Walter Roberson on 7 Feb 2016
You need to show us which line the error is on, and you need to show us size() of each variable that appears on that line. For example, size(q), size(FI), size(Tot_Fairness_inner) if that happens to be the plot() call that is causing the problem.

Sign in to comment.

Answers (1)

Jan
Jan on 8 Feb 2016
You can use the debugger to identify the problem:
dbstop if error
Then run the code again. Now Matlab stops at the failing line and you can inspect the sizes of the locally used variables - e.g. for the 1st plot command:
size(k)
size(Tot_Fairness_out)
size(average_Tot_fairness_out)
Is there any array with more than 2 dimensions? If so, how do you want to display it?

Categories

Find more on Graphics Objects 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!