Info
此问题已关闭。 请重新打开它进行编辑或回答。
when i testing the datasets by inserting corrupted value i keep on getting the error such as ???index exceed matrix. what is the meaning??
1 次查看(过去 30 天)
显示 更早的评论
% TESTING
% we test the model see if it can return a corrupted sample ? here we made % sample #1 corrupted, that is every 5 correct value, we inject a corrupted % value (average 4). So, 6 5 4 4 3 6 ... blah blah is changed to % 6 5 4 4 3 4 ... blah blah
testRecord= [6 5 4 4 3 4 ] testRecord=(testRecord-1)./6; % standardization by squashing within 0,1
test=testRecord;
for equ=1:10 test=test*W; % for 10 times, we apply the model (W) to the test record to rebuild it for fix=1:30 % remeber, every time those certain values within test record must be retained test(fix*6-5:fix*6-1)=testRecord(fix*6-5:fix*6-1); end end
test=test*6+1 % back to Original data format
max(abs(Original(1,:)-test)) % now compare the rebuilt record #1 with the original record #1 to get the maximum error
0 个评论
回答(1 个)
Chris C
2014-3-12
testRecord is an array of 6 elements. You call an indexed value of testRecord within your for loop using
testRecord(fix*6-5:fix*6-1);
If you look at the math that can give testRecord(175:179). You don't have elements 175,176,177,178 or 179 in your array and instead only have 1-6. I think what you're trying to do is alter the data contained within that element. In order to do that you must first call the element (i.e. testRecord(2)) and then perform mathematical operations on the data that indexed element retrieves.
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!