将矩阵元素映射到字符串 [英] Map matrix element to string
本文介绍了将矩阵元素映射到字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
给定
compute = [7,4,3; 3,4,7]
如何获取字符串映射为
Out = [Run,Walk,Jog;点动,步行,运行]
实际的输出可能是字符串的单元格数组。
解决方案
我假设你有一个单元格数组的形式
>>地图{3} ='慢跑';
>> map {4} ='Walk';
>> map {7} ='Run';
现在使用地图
map(compute)
将给你一个单元格数组的字符串
I would like to map numeric output from a matrix to a string.
Given
compute=[ 7, 4, 3; 3, 4, 7]
how can one obtain a string mapping as
Out=[Run, Walk, Jog; Jog, Walk, Run]
The actual output might be a cell array of strings.
解决方案
I assume you have the map in a form of a cell array
>> map{3} = 'Jog';
>> map{4} = 'Walk';
>> map{7} = 'Run';
Now use the map
map( compute )
will give you a cell array of strings
这篇关于将矩阵元素映射到字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文