help-octave
[Top][All Lists]
Advanced

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

Re: help how do I multiply a scalar by a cell (element) and store in a s


From: Jordi Gutiérrez Hermoso
Subject: Re: help how do I multiply a scalar by a cell (element) and store in a scalar
Date: Sun, 9 Sep 2012 16:59:35 -0400

On 9 September 2012 16:37, Jerry Baucum <address@hidden> wrote:
> Sample =
> {
>   [1,1] = -0.12300
>   [1,2] =  0.23400
> }
>
> value = pi * Sample(1,2)
>
> I'm running up against the error
>
> error: binary operator `*' not implemented for `scalar' by `cell' operations

Do you really want a cell array and not a matrix?

If so, do

    cellfun(@times, c, {5}, 'Unif', false)

Otherwise, use matrices:

    Sample = [0.12; 0.34];
    5*Sample

HTH,
- Jordi G. H.


reply via email to

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