Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String 打印字符串向量_String_Matlab_Char - Fatal编程技术网

String 打印字符串向量

String 打印字符串向量,string,matlab,char,String,Matlab,Char,我有一个双向量,即,x=[1234]。x中的每个元素都有一个对应的字符串,例如,1:'4',2:'16',3:'4+,4:'100-,这是非常随机的对应。现在给定x中元素的任意顺序,我想在MATLAB中打印相应的字符串 例如,如果input=[2 1 3 4],我想在MATLAB中打印“输出为16 4+100-”,这些字符串之间留有空格。如有任何建议,我们将不胜感激。谢谢。字符串是如何存储的?我这样假设: str = {'4', '16', '4+', '100-'} input = [2 1

我有一个双向量,即,
x=[1234]
x
中的每个元素都有一个对应的字符串,例如,
1
'4'
2
'16'
3
'4+
4
'100-
,这是非常随机的对应。现在给定
x
中元素的任意顺序,我想在MATLAB中打印相应的字符串


例如,如果
input=[2 1 3 4]
,我想在MATLAB中打印
“输出为16 4+100-”
,这些字符串之间留有空格。如有任何建议,我们将不胜感激。谢谢。

字符串是如何存储的?我这样假设:

str = {'4', '16', '4+', '100-'}
input = [2 1 3 4]
在这种情况下,你有几个选择,例如:

sprintf('The output is %s %s %s %s', str{input})
否则

['The output is ', strjoin(str(input))]

字符串是如何存储的?我这样假设:

str = {'4', '16', '4+', '100-'}
input = [2 1 3 4]
在这种情况下,你有几个选择,例如:

sprintf('The output is %s %s %s %s', str{input})
否则

['The output is ', strjoin(str(input))]

字符串/字符串是如何存储的?字符串/字符串是如何存储的?