mulptiply each column of a cell matrix by 4 when it contains strings and NaN

1 次查看(过去 30 天)
Dear all
I have
Aq = {
'adidas' 'shoes' 'wow'
[ 0.6692] [ 0.8646] [8.7778e+003]
[ 0.6692] [ 0.8646] [8.7778e+003]
[ 0.6574] [ 0.9949] [5.8947e+003]
[ 0.6574] [ 0.9949] [5.8947e+003]
[ 0.6515] [ 0.7855] [9.0872e+003]
[ 0.6515] [NaN] [9.0872e+003]
[ 0.6668] [ 0.9097] [4.5158e+003]
[ 0.6668] [ 0.9097] [4.5158e+003]
[ 0.6461] [ 0.7369] [1.3001e+004]
[ 0.6461] [ 0.7369] [NaN]
[ 0.6666] [ 0.8229] [9.2713e+003]
[ 0.6666] [ 0.8229] [9.2713e+003]
[ 0.6156] [ 0.7726] [9.1033e+003]
[ 0.6156] [ 0.7726] [9.1033e+003]
[ 0.5855] [ 0.7962] [6.1476e+003]
[ 0.5855] [ 0.7962] [6.1476e+003]
[ 0.5894] [ 0.7112] [9.4473e+003]}
I would like to multiply each column with 8
thanks

采纳的回答

Andrei Bobrov
Andrei Bobrov 2012-7-27
t = ~cellfun(@ischar,Aq);
Aq(t) = cellfun(@(x)x*8,Aq(t),'un',0);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 NaNs 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by