Cell Array Indexing of HEX values
3 次查看(过去 30 天)
显示 更早的评论
Hello,
I have a HEX cell array and I use importdata function to import them.
a = importdata('C:\User\Desktop\text.txt');
It gives me 2x1 cell '0F 04 0A 0E 1E 2F' and '3E 2A 1F 03 05 0A'
For example, I want to take 0E from there, how can I index this element? Thank you.
0 个评论
采纳的回答
Voss
2022-6-2
编辑:Voss
2022-6-2
a = {'0F 04 0A 0E 1E 2F', '3E 2A 1F 03 05 0A'};
C = squeeze(split(a,' '))
C{1,4}
2 个评论
Voss
2022-6-2
编辑:Voss
2022-6-2
Try it and see:
a = {'0F 04 0A 0E 1E 2F', '3E 2A 1F 03 05 0A'};
C = squeeze(split(a,' '));
C(1, 4:5)
Seems to work.
Note that subscripting a cell array with parentheses ( ) like that gives you another cell array. To get the contents of the cells instead, use braces { }:
C{1, 4:5}
And you may want to concatenate those 2 outputs together, using square brackets [ ]:
[C{1, 4:5}]
Another example:
[C{2,:}]
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cell Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!