Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to transform the contents of a matrix into integer values

    Dear All,

    I am working with a matrix whose content is composed by values that are codified as floating point.

    I would like to kindly ask you if there is a way to transform these "values" within a matrix into integer values.

    Of course I am not dealing with a variable in which case I could use the destring command.

    Many thanks.

    Marco

  • #2
    1. It it's a Mata matrix apply round() or floor() or ceil()

    2. If it's a Stata matrix push into Mata ... pull out of Mata.

    3. If it's a Stata matrix write your own loops over rows and columns.

    4. If it's a Stata matrix use matmap (SSC).

    . ssc desc matmap

    -------------------------------------------------------------------------------
    package matmap from http://fmwww.bc.edu/repec/bocode/m
    -------------------------------------------------------------------------------

    TITLE
    'MATMAP': module to perform elementwise calculations for matrices

    DESCRIPTION/AUTHOR(S)

    Given a matrix A and a user-supplied expression, matmap
    calculates a matrix B in which each element is the result of
    that expression given the corresponding element of matrix A. B
    may overwrite A. This routine supersedes the previously posted
    matewmf.

    Author: Nicholas J. Cox, University of Durham
    Support: email [email protected]

    Distribution-Date: 20000823

    INSTALLATION FILES (type net install matmap)
    matmap.ado
    matmap.hlp
    -------------------------------------------------------------------------------
    (type ssc install matmap to install)

    Comment


    • #3
      Dear Prof. Cox,

      I do thank you very much for your indication. I will try and keep you posted.

      Many many thanks.

      Marco

      Comment

      Working...
      X