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.

 Respuesta aceptada

Stephen23
Stephen23 el 27 de Feb. de 2018
Editada: Stephen23 el 27 de Feb. de 2018
>> 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

Más respuestas (0)

Etiquetas

Preguntada:

el 27 de Feb. de 2018

Comentada:

el 27 de Feb. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by