How can i split a large integer into fix size groups?

I have a large integer/hexadecimal value:
2329363532333233313131363536353635254B53484744534A4844534A4B4A4B4A4B6146484A484A765E383838382A2A2A2A2F313432333600
I want to split it into groups of 47 each..the last group may contain less than 47 digits. eg. output
group1:2329363532333233313131363536353635254B534847445
group2:34A4844534A4B4A4B4A4B6146484A484A765E383838382
and so on.

 采纳的回答

>> S = '2329363532333233313131363536353635254B53484744534A4844534A4B4A4B4A4B6146484A484A765E383838382A2A2A2A2F313432333600';
>> M = 47;
>> N = numel(S)-1;
>> V = [M*ones(1,floor(N/M)),1+mod(N,M)];
>> C = mat2cell(S,1,V);
>> C{1}
ans = 2329363532333233313131363536353635254B534847445
>> C{2}
ans = 34A4844534A4B4A4B4A4B6146484A484A765E383838382A
>> C{3}
ans = 2A2A2A2F313432333600

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Structures 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by