unpack and pack matlab charArray correctly