How to use a for loop to create a table to display special characters.

3 ビュー (過去 30 日間)
Kalpha.mc
Kalpha.mc 2020 年 11 月 7 日
コメント済み: Kalpha.mc 2020 年 11 月 8 日
I need to get the rest of the numbers and characters in between?
for t = 1
between = (180:1:200);
char = char(between);
fprintf('%d %c\n',between , char);
end
output =
180 µ
182 ·
184 ¹
186 »
188 ½
190 ¿
192 Á
194 Ã
196 Å
198 Ç
200 ´
181
183 ¸
185 º
187 ¼
189 ¾
191 À
193 Â
195 Ä
197 Æ
  1 件のコメント
Stephen23
Stephen23 2020 年 11 月 7 日
Rather than putting meta-data into variable names (ie..'a', 'b', ...) much simpler and more efficient code would simply store the data and meta-data in two vectors:
table = [180,181,182,183,184,185,186,187,189,190,191,192,193,194,195,196,197,198,199,200];
chars = 'abcdefghijklmnopqrst';
fprintf('%d = %c\n', [table; chars]);

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

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 11 月 8 日
Are you looking for something like this
between = (180:1:200);
chars = char(between);
fprintf('%d %c\n', [between; chars]);
Result
180 ´
181 µ
182
183 ·
184 ¸
185 ¹
186 º
187 »
188 ¼
189 ½
190 ¾
191 ¿
192 À
193 Á
194 Â
195 Ã
196 Ä
197 Å
198 Æ
199 Ç
200 È
  3 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 11 月 8 日
No, your code is different. Have you tried running my code?
Kalpha.mc
Kalpha.mc 2020 年 11 月 8 日
yes, i know why it didnt work i didn't add the s. Thank you!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by