I want to create a function in MATLAB which converts a string into a 4 bytes array.
I've found this function typecast
which works perfectly,
but I want to store the four bytes into my four outputs.
tab = typecast(single(30),'uint8')
This gives tab = 00 00 f0 41
.
I try to display tab(0)
but it shows the error
Subscript indices must be real positive or logicals
Can anyone help me to create the function and how to call it to get my four bytes? I want to include it in a Simulink block to do the conversion.
Indices in MATLAB start from 1, not 0. Try tab(1)
instead.