Help with Barcode reading!
5 views (last 30 days)
Show older comments
So there is this barcodes matrix
barcodes = {':...:::.:.....::::....:..::.:..:.:..:.:..:..:.::...';
':.:.:...::.:...:::....::..:.:....::...:.:...::.:..:'};
I'm trying to associate specific dots and colons to a specific numeric value to be able to read the barcode.
Given:
1 = ...::
2 = ..:.:
3 = ..::.
4 = .:..:
5 = .:.:.
6 = .::..
7 = :...:
8 = :..:.
9 = :.:..
0 = ::...
How can I write a for loop function that coverts barcodes matrix into numbers?
0 Comments
Accepted Answer
Image Analyst
on 30 Nov 2013
I just answered this yesterday: http://www.mathworks.com/matlabcentral/answers/108076#answer_116773 with the very same codes. Perhaps megan is your classmates. So it looks like it must be homework, which, to be honest, means you should have tagged your post with a "homework" tag.
3 Comments
Image Analyst
on 30 Nov 2013
You have to get each cell's contents. Evidently it's a string of 51 characters. Now somehow, I don't know how, but you're going to have to split that 51 characters up into substrings of 5 characters each.
% Get the k'th cell's contents in the cell array.
thisString = barcodes{k};
% Extract the first 5 characters.
thisSubstring = thisString(1:5); % and so on.
Then use the look up table approach I gave Megan.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!