Merging Cell Array Elements in One Element

3 次查看(过去 30 天)
Hello,
I have a cell array and its elements are like
1x4 cell array
{'1A'}
{'2B'}
{'3C'}
{'4D'}
I don't want to access them seperately, what I want is merge them like
1x1 cell array
{'1A2B3C4D'}
so that I can convert it to decimal easily. How can I do that? Thank you.

采纳的回答

VINAYAK LUHA
VINAYAK LUHA 2022-6-3
Hi ,
CellArr ={'1A','2B','3C','4D'}
CellArr = 1×4 cell array
{'1A'} {'2B'} {'3C'} {'4D'}
MergedCellArr = [CellArr{:}]
MergedCellArr = '1A2B3C4D'
DecValue = hex2dec(MergedCellArr)
DecValue = 439041101

更多回答(1 个)

Johan
Johan 2022-6-3
test= [{'1A'}
{'2B'}
{'3C'}
{'4D'}]
test = 4×1 cell array
{'1A'} {'2B'} {'3C'} {'4D'}
{cell2mat(test')}
ans = 1×1 cell array
{'1A2B3C4D'}

类别

Help CenterFile Exchange 中查找有关 Cell Arrays 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by