.* multiplication of a logical vector with a cell vector

Home Forums Matlab .* multiplication of a logical vector with a cell vector

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  cK 9 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #521

    vneelam
    Participant

    How can I do .* multiplication of a logical vector to a cell vector?
    Multiplication is giving an error
    “Undefined function ‘times’ for input arguments of type ‘cell’.”

    Thanks in advance.
    Regards
    Neelam

    #522

    cK
    Keymaster

    Cells are special containers and most of the math ops are unsupported for cells. However, there exist quite some workarounds. If x is a cell with numeric elements, y=[x{:}] creates a vector y from elements of x. See cell2mat() and mat2cell(). If x is a string cell, the aforementioned op produces a row vector, with all strings of x fused together. If a column vector is desired with each row retaining the distinct elements of x, char(x{:}) or strvcat(x{:}) is the way.

    • This reply was modified 9 years, 8 months ago by  cK.
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.