字符串转换为MATLAB中的数组数 [英] convert string to number array in matlab

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

问题描述

我在其中输入脚本数字的字符串

 字符串='123'

 字符串='9823'

我想这个转换成表格[A,B,C,D]数组
从'123'至数值阵列的串例如[1,2,3]

这是如何做到这一点任何提示?


解决方案

 海峡='123';
NUM = STR - '0';
%NUM = [1 2 3];

I have a script in which a string of number is entered

string='123'

or

string='9823'

I am trying to convert this into an array of the form [a,b,c,d] e.g from a string of '123' to a numerical array [1,2,3]

Any tips on how to do this?

解决方案

str = '123';
num = str - '0';
% num = [1 2 3];

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

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