conver 8x10 char to array in matlab

You can use the reshape function in MATLAB to convert an 8x10 character array into an 8-by-10 element array. Here is an example code snippet:

main.m
% Create a sample 8x10 character array
char_arr = ['a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j';
            'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't';
            'u' 'v' 'w' 'x' 'y' 'z' 'A' 'B' 'C' 'D';
            'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M' 'N';
            'O' 'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' 'X';
            'Y' 'Z' '0' '1' '2' '3' '4' '5' '6' '7';
            '8' '9' '#' '$' '%' '&' '@' '?' '!' '*';
            '(' ')' '+' '-' '/' '\' '|' '{' '}' ';'];

% Convert the character array to a numeric array using the reshape function
num_arr = reshape(char_arr, [8 10]);

% Display the numeric array
disp(num_arr)
621 chars
16 lines

This code will output the numeric array that corresponds to the character array:

main.m
    97   107   117   69   79   89   56   40  35   36
    98   108   118   70   80   90   57   41  36   37
    99   109   119   71   81   48   35   43  36   43
   100   110   120   72   82   49   36   45  47   45
   101   111   121   73   83   50   92   47  92   47
   102   112   122   74   84   51   124 124  64   42
   103   113    65   75   85   52   123 125  63   33
   104   114    66   76   86   53    59  45  33   42
424 chars
9 lines

related categories

gistlibby LogSnag