how to concatenate multiple columns of an array to single column in matlab?
Show older comments
I used dectohex function to convert a set of bytes to hexadecimal.For example A=[255 216].h=dec2hex(A) is giving me a 2*2 matrix instead of 2*1.First F is in one column and 2nd F in another column.I wanted the FF to be in single cell.
h=
FF
D8
Answers (2)
James Tursa
on 26 May 2015
Edited: James Tursa
on 26 May 2015
To convert to a cell array of strings, e.g.,
mat2cell(h,ones(size(h,1),1),2)
This encapsulates the rows h(row,:) in individual cells. Is that what you want?
Star Strider
on 26 May 2015
If you have the strsplit function:
A=[255 216];
h = strsplit(sprintf('%2X %2X', A), ' ')'
h =
'FF'
'D8'
Categories
Find more on Matrices and Arrays 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!