How to solve index exceeds matrix dimensions - MATLAB

Status
Not open for further replies.

sadhna

Newbie level 5
Joined
May 31, 2012
Messages
8
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,312
data = getdata(vid,50,'double','cell');
for i=1:5:100
data{i},:,1)=(data{i},:,1))+(data{i+1},:,1))+(data{i+2},:,1))+ ...
(data{i+3},:,1))+(data{i+4},:,1))/5;
data{i},:,3)=(data{i},:,3))+(data{i+1},:,3))+(data{i+2},:,3))+...
(data{i+3},:,3))+(data{i+4},:,3))/5;
data{i},:,2)=(data{i},:,2))+(data{i+1},:,2))+(data{i+2},:,2))+...
(data{i+3},:,2))+(data{i+4},:,2))/5;
end
 

The variable 'data' will now contain a cell array with details of only 50 frames...
But, inside the 'for' loop, you are trying to access till 100, which results in the error
'index exceeds matrix dimensions'...
Inside the 'for' loop i varies as shown:- 1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91 96

data = getdata(vid,100,'double','cell'); or for i=1:5:50
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…