4
我有三个阵列,所有具有相同的尺寸:MATLAB:从双阵列矢量分配给单元阵列
xout % cell array
xin % numeric array of doubles
b % logical array
如何可以采取对应于其中b为真索引鑫的元素,并分配他们到相应的地方在XOUT?
>> xout = {'foo', 'bar', 'baz', 'quux'};
>> xin = [1, 2, 3, 4];
>> b = (xin ~= 2); % yields [1 0 1 1] in this case
>> xout{b}=xin(b);
??? The right hand side of this assignment has too few values
to satisfy the left hand side.
>> xout(b)=xin(b);
??? Conversion to cell from double is not possible.
卫生署!这工作,谢谢。 – 2009-11-03 20:35:34