help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Applying a function to selected element type in a mixed-type cell array


From: Philip Nienhuis
Subject: Applying a function to selected element type in a mixed-type cell array
Date: Mon, 21 May 2012 23:43:36 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.11) Gecko/20100701 SeaMonkey/2.0.6

Suppose a cell array like:

arr = {10, int32(15), 'Txt'; '', 25, true; NaN, 'String', single(100)}

How can all numeric values efficiently (w/o for loops etc.) be converted to double, leaving the other cell array contents untouched?

Getting at something like "arr(find (cellfun ("isnumeric", [arr])))" is easy enough, but the follow-up is a hazy to me.

Thanks,

Philip


reply via email to

[Prev in Thread] Current Thread [Next in Thread]