index exceeds the number of array elements (5)

조회 수: 1 (최근 30일)
CHRISTOPHER MILLAR
CHRISTOPHER MILLAR 2019년 3월 15일
댓글: CHRISTOPHER MILLAR 2019년 3월 26일
I have a basic Matlab script that has been working fine for weeks and now it throws an error
'Index exceeds the number of array elements (5)."
Error in test (line 27)
subplot(4,2,2),plot(testTime,emg2),ylim([-128 128]);title('emg2');
How do i know what index in what array the error is talking about?
It still plots the 1st graph but nothing after that, when i quit matlab and run it works fine but wont run again unless i quit out of matlab
CAn anybody suggest what i can do to debug this script?
testData = m1.emg_log;
testTime = m1.timeEMG_log;
completeDataSet = [testTime,testData];
emg1=testData(:,1);
emg2=testData(:,2);
emg3=testData(:,3);
emg4=testData(:,4);
emg5=testData(:,5);
emg6=testData(:,6);
emg7=testData(:,7);
emg8=testData(:,8);
figure;
subplot(4,2,1),plot(testTime,emg1),ylim([-128 128]);title('emg1');
subplot(4,2,2),plot(testTime,emg2),ylim([-128 128]);title('emg2');
subplot(4,2,3),plot(testTime,emg3),ylim([-128 128]);title('emg3');
subplot(4,2,4),plot(testTime,emg4),ylim([-128 128]);title('emg4');
subplot(4,2,5),plot(testTime,emg5),ylim([-128 128]);title('emg5');
subplot(4,2,6),plot(testTime,emg6),ylim([-128 128]);title('emg6');
subplot(4,2,7),plot(testTime,emg7),ylim([-128 128]);title('emg7');
subplot(4,2,8),plot(testTime,emg8),ylim([-128 128]);title('emg8');
I am pretty new to Matlab so not 100% familiar with it yet
  댓글 수: 5
CHRISTOPHER MILLAR
CHRISTOPHER MILLAR 2019년 3월 19일
Thanks for the responses
I have got a bit closer to figuring out the problem, i have another script that i call at the end that i use to save the recorded data to an excel spreadsheet and something is causing the error in that script
CHRISTOPHER MILLAR
CHRISTOPHER MILLAR 2019년 3월 26일
Solved this issue
the other script i was linking to had a variable called title which was confusing the program

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

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

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by