Possible Duplicate:
convert string to number array in matlab
I have a vector y including values '1' '2' '3'
char values and I want to convert it to a corresponding integer vector. If I used str2num
it gives 49 50 51
like numbers. How could I do it ?
y - '0'
Subtracts the ASCII value for '0'
from each vector element, taking advantage of the fact that the ASCII values for digits are contiguous.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With