Adding matrix values into a string

2 views (last 30 days)
Hello,
I want to turn a matrix
a=[1 2 3 4 5 6 7 8 9] for say
into a string with the three first values of the array
b=123;
Any ideas how to do it?

Accepted Answer

KSSV
KSSV on 2 Dec 2020
a=[1 2 3 4 5 6 7 8 9] ;
str = char(a+'0')
str = '123456789'
  3 Comments
KSSV
KSSV on 2 Dec 2020
a=[1 2 3 4 5 6 7 8 9] ;
str = char(a(1:3)+'0')
str = '123'

Sign in to comment.

More Answers (0)

Categories

Find more on Characters and Strings 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!