HOW TO READ SPECIAL CHARACTERS IN A SINGLE ARRAY

a1=('a':'z');
b1=('A':'Z');
c1=('0':'9')
IN the above commands a1 contains a to z, and b1 contains A to Z, *c1 contains 0 to 9.
in the similar way how to read special characters like , . ! @ # $ % ^ & * ( ) _ in a single array

回答 (2 件)

Benjamin Avants
Benjamin Avants 2014 年 3 月 14 日

0 投票

If you look up the ascii values of the characters you're looking for, you can make an array of those values and then cast it to char
Example:
d1 = 1:33;
d1 = char(d1);

3 件のコメント

Walter Roberson
Walter Roberson 2014 年 3 月 14 日
Note though that the initialization gets long and tedious if you want the printable characters available in UNICODE up to code point 65535
sonam s
sonam s 2014 年 3 月 14 日
編集済み: sonam s 2014 年 3 月 14 日
d1 = 1:33;
d1 = char(d1);
*tTHANK YOU .BUT THE CODE IS NOT WORKING .IT IS DISPLAYING 33 SQUARE BOXES .PLEASE HELP *
Benjamin Avants
Benjamin Avants 2014 年 3 月 14 日
1:33 was just an example. You'll need to look up the actual ascii character values online. I would suggest a google search for "ascii table". I think most of the characters in the 1:33 range are special characters, not symbols. Try the range 33:47 for a few of the printable characters.

サインインしてコメントする。

Walter Roberson
Walter Roberson 2014 年 3 月 14 日
編集済み: Walter Roberson 2014 年 3 月 15 日

0 投票

char([33:47, 58:64, 91:96, 123:126])
after that one gets into the non-ASCII characters such as '©'.
Another way of expressing this is:
d1 = union(union(a1, b1), c1);
d2 = setdiff(' '+1:127, d1);
Note: earlier I had setintersect() instead of setdiff()

カテゴリ

ヘルプ センター および File ExchangeMATLAB Compiler についてさらに検索

質問済み:

2014 年 3 月 14 日

編集済み:

2014 年 3 月 15 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by