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

1 visualización (últimos 30 días)
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

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 27 de Jul. de 2012
t = ~cellfun(@ischar,Aq);
Aq(t) = cellfun(@(x)x*8,Aq(t),'un',0);

Más respuestas (0)

Categorías

Más información sobre NaNs en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by