how to concatenate multiple columns of an array to single column in matlab?

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

Respuestas (2)

James Tursa
James Tursa el 26 de Mayo de 2015
Editada: James Tursa el 26 de Mayo de 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?
If you have the strsplit function:
A=[255 216];
h = strsplit(sprintf('%2X %2X', A), ' ')'
h =
'FF'
'D8'

Categorías

Más información sobre Matrices and Arrays en Centro de ayuda y File Exchange.

Preguntada:

el 26 de Mayo de 2015

Respondida:

el 26 de Mayo de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by