将字母转换为数字 [英] Convert Letter to Number

查看:198
本文介绍了将字母转换为数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  A = 1 
B = 2
C = 3

我的所有数字都是大写。当然,我可以为每个字符定义常量,但是有更短的方法吗?



谢谢!

解决方案

查看 char 函数。您可以给它一个整数参数。



http://www.mathworks.com/help/matlab/ref/char.html


I'm new to matlab ... I simply would like to convert letter to numbers such that:

A=1
B=2
C=3

all my numbers are capital case. Off course, I could define constant for each char, but is there a shorter way?

Thanks!

解决方案

See the char function. You can give it an integer argument.

http://www.mathworks.com/help/matlab/ref/char.html

这篇关于将字母转换为数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆