# spfun

## Purpose

Apply function to nonzero entries.

## Synopsis

    f = spfun('function',S)

## Description

`f = spfun('function',S)` evaluates `function(S)` on the nonzero elements of `S`. `function` must be the name of a function, usually defined in an M-file, which can accept a matrix argument, `S`, and evaluate the function at each element of `S`.

## Examples

`f = spfun('exp',S)` has the same sparsity pattern as `S` (except for underflow), whereas `exp(S)` has 1s where `S` has 0s.

(c) Copyright 1994 by The MathWorks, Inc.