MATLAB:Selection-值而不是位置
MATLAB:Selection-values instead of postions
我有一个元胞数组,其元素显示工作区中所选内容中值的位置。
现在我想保留相同的元胞数组,但用值替换位置。
我的手机:
res{1}=[55 56 57 58]
res{2}=[80 81]
res{3}=[111 112 113 114 115 116 117]
我的选择"Channel":
55:0.1
56:0.2
57:0.3
58: 0.4
我想要的:
res{1}=[0.1 0.2 0.3 0.4]
res{2}=....
我试过了res={channel}
.但是当我这样做时,我只得到一个长向量。
res{1}
是您想要 channel
的索引列表,对吗?所以只需要将它们放回原来的元胞数组中即可。既然你有倍数,不妨将它包装在一个循环中:
for n = 1:numel(res)
res{n} = channel(res{n})
end
例如对于 res{1} = [55 56 57 58]
这相当于 res{1} = channel([55 56 57 58])
我有一个元胞数组,其元素显示工作区中所选内容中值的位置。 现在我想保留相同的元胞数组,但用值替换位置。
我的手机:
res{1}=[55 56 57 58]
res{2}=[80 81]
res{3}=[111 112 113 114 115 116 117]
我的选择"Channel":
55:0.1 56:0.2 57:0.3 58: 0.4
我想要的:
res{1}=[0.1 0.2 0.3 0.4]
res{2}=....
我试过了res={channel}
.但是当我这样做时,我只得到一个长向量。
res{1}
是您想要 channel
的索引列表,对吗?所以只需要将它们放回原来的元胞数组中即可。既然你有倍数,不妨将它包装在一个循环中:
for n = 1:numel(res)
res{n} = channel(res{n})
end
例如对于 res{1} = [55 56 57 58]
这相当于 res{1} = channel([55 56 57 58])