Help with Barcode reading!

5 views (last 30 days)
Ali
Ali on 30 Nov 2013
Commented: Image Analyst on 30 Nov 2013
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?

Accepted Answer

Image Analyst
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
Ali
Ali on 30 Nov 2013
Hey,
I looked at your answer to Megan, but it's is a bit different than mine. How can I translate the whole code into sets of 10 digit numbers? (The codes each represent 10 digits)
Image Analyst
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.

Sign in to comment.

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!