{"action":"closed","issue":{"url":"https://api.github.com/repos/digitalinteraction/openmovement/issues/15","repository_url":"https://api.github.com/repos/digitalinteraction/openmovement","labels_url":"https://api.github.com/repos/digitalinteraction/openmovement/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/digitalinteraction/openmovement/issues/15/comments","events_url":"https://api.github.com/repos/digitalinteraction/openmovement/issues/15/events","html_url":"https://github.com/digitalinteraction/openmovement/issues/15","id":64683223,"number":15,"title":"Matlab AX3_readFile - last packet has incorrect data read due to off-by-one packet count","user":{"login":"Woodz","id":966157,"avatar_url":"https://avatars.githubusercontent.com/u/966157?v=3","gravatar_id":"","url":"https://api.github.com/users/Woodz","html_url":"https://github.com/Woodz","followers_url":"https://api.github.com/users/Woodz/followers","following_url":"https://api.github.com/users/Woodz/following{/other_user}","gists_url":"https://api.github.com/users/Woodz/gists{/gist_id}","starred_url":"https://api.github.com/users/Woodz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Woodz/subscriptions","organizations_url":"https://api.github.com/users/Woodz/orgs","repos_url":"https://api.github.com/users/Woodz/repos","events_url":"https://api.github.com/users/Woodz/events{/privacy}","received_events_url":"https://api.github.com/users/Woodz/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/digitalinteraction/openmovement/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2015-03-27T03:14:49Z","updated_at":"2016-09-16T13:15:51Z","closed_at":"2016-09-16T13:15:51Z","body":"When using AX3_readFile, the last packet read is incorrect. With my test file it returns LIGHT values of 887, 885 and 21044, TEMP values of 23.15, 23.15, 0 and ACC values of 0. Stepping into the packet reading code at https://github.com/digitalinteraction/openmovement/blob/master/Software/Analysis/Matlab/AX3_readFile.m#L243 shows that the offset calculation is off-by-one, as the vector `validIds` contains the base-1 index of the packet (e.g. 3, 4, 5). However, in the read operation of `fseek(fid,validIds(i)*512+18,-1)`, packet 3 (which starts at 1024 (packet 1 = offset 0, packet 2 = offset 512, packet 3 = offset 1024)) is actually read from position 1536 (3 * 512). Therefore all data reading code should be corrected to `(validIds(i) - 1) * 512 + `... to correctly compensate for the base-1 index."}}
{"actor":{"display_login":"danielgjackson"}}