Can I convert a linear vector into a number?

 Accepted Answer

b = str2double(sprintf('%d',a))
other way
b = 10.^(numel(a)-1:-1:0)*a

1 Comment

may be a slight correction in your second way:
b = sum(10.^(numel(a)-1:-1:0).*a)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!