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

回答(1 个)

Chris C
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.

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by