Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

How to split data from variable??

Asked by Kushal Khaitan

Kushal Khaitan

on 19 Jan 2013
Accepted Answer by Walter Roberson

Walter Roberson

datahex = sprintf('%02x', data);

I have converted image into array named data and then converted into hexadecimal.

Now I want to apply AES algorithm on it. But at a time only 16 bytes are are required.

How to read 16 characters from this datahex then next 16 and so on until all have been read.

I have AES algorithm and want to read 16 bytes at a time and then next 16 bytes.

Plz help....thanx


Kushal Khaitan

Kushal Khaitan


No products are associated with this question.

1 Answer

Answer by Walter Roberson

Walter Roberson

on 19 Jan 2013
Accepted answer
for K = 1 : 32 : length(datahex)
  datasubset = datahex(K : K + 31);
  ... work with datasubset ...

Note here that it takes 2 hex digits to form one byte.


Walter Roberson

Walter Roberson

Contact us