New to matlab and I do not understand given code
Show older comments
When IC is a seven digit number and I need to add the digits in the odd numbered position which ic variable x and I need to add the digits in the even numbered posititon which is variable y. The answer I was given states that when using the sum() i need to minus 48 from both and I do not understand why.
x = sum((ic(2:2:end)-48))
y = sum((ic(3:2:end)-48))
Accepted Answer
More Answers (0)
Categories
Find more on Data Type Conversion 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!