So my output hexadecimal code is saved in a cell in the following format.
{'00 11 22 33 AA BB'}
I am trying to have it output as
{'1100 3322 BBAA'}
Any help would be greatly appreciated.

 채택된 답변

Stephen23
Stephen23 2018년 8월 9일
편집: Stephen23 2018년 8월 9일

0 개 추천

This is easy with regexprep:
>> C = {'00 11 22 33 AA BB'};
>> regexprep(C,'(\w{2}) (\w{2})','$2$1')
ans =
'1100 3322 BBAA'

추가 답변 (1개)

OCDER
OCDER 2018년 8월 9일

0 개 추천

A = {'00 11 22 33 AA BB'; '00 11 22 3D AA BC'; '02 11 32 33 AA BB'};
A = cellfun(@(x) sprintf('%c%c%c%c %c%c%c%c %c%c%c%c', strrep(x, ' ', '')), A, 'un', false);
A =
3×1 cell array
'0011 2233 AABB'
'0011 223D AABC'
'0211 3233 AABB'

댓글 수: 2

Stephen23
Stephen23 2018년 8월 9일
Note that this does not return the order that the question requests.
OCDER
OCDER 2018년 8월 9일
Doh, I didn't see that order change.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

질문:

2018년 8월 9일

댓글:

2018년 8월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by