📄 mf_editvalue.hlp
字号:
{smcl}
{* 11mar2005}{...}
{cmd:help mata editvalue()}
{hline}
{* index editvalue()}{...}
{* index _editvalue()}{...}
{title:Title}
{p 4 8 2}
{bf:[M-5] editvalue() -- Edit (change) values in matrix}
{title:Syntax}
{p 8 8 2}
{it:matrix}
{cmd:editvalue(}{it:matrix A}{cmd:,}
{it:scalar from}{cmd:,}
{it:scalar to}{cmd:)}
{p 8 8 2}
{it:void}{bind: }
{cmd:_editvalue(}{it:matrix A}{cmd:,}
{it:scalar from}{cmd:,}
{it:scalar to}{cmd:)}
{p 4 4 2}
where {it:A}, {it:from}, and {it:to} may be real, complex, or string.
{title:Description}
{p 4 4 2}
{cmd:editvalue(}{it:A}{cmd:,} {it:from}{cmd:,} {it:to}{cmd:)}
returns {it:A} with all elements equal to {it:from} changed to {it:to}.
{p 4 4 2}
_{cmd:editvalue(}{it:A}{cmd:,} {it:from}{cmd:,} {it:to}{cmd:)}
does the same thing, but modifies {it:A} itself.
{title:Remarks}
{p 4 4 2}
{cmd:editvalue()} and {cmd:_editvalue()} are very fast.
{p 4 4 2}
If you wish to change missing values to nonmissing values, it is
better to use {bf:{help mf_editmissing:[M-5] editmissing()}}.
{cmd:editvalue(}{it:A}{cmd:, ., 1)} would change all {cmd:.} missing
values to 1, but leave {cmd:.a}, {cmd:.b}, ..., unchanged.
{cmd:editmissing(}{it:A}{cmd:, 1)} would change all missing values to 1.
{title:Conformability}
{cmd:editvalue(}{it:A}{cmd:,} {it:from}{cmd:,} {it:to}{cmd:)}:
{it:A}: {it:r x c}
{it:from}: 1 {it:x} 1
{it:to}: 1 {it:x} 1
{it:result}: {it:r x c}
{cmd:_editvalue(}{it:A}{cmd:,} {it:from}{cmd:,} {it:to}{cmd:)}:
{it:input:}
{it:A}: {it:r x c}
{it:from}: 1 {it:x} 1
{it:to}: 1 {it:x} 1
{it:output:}
{it:A}: {it:r x c}
{title:Diagnostics}
{p 4 4 2}
{cmd:editvalue(}{it:A}{cmd:,} {it:from}{cmd:,} {it:to}{cmd:)} returns
a matrix of the same type as {it:A}.
{p 4 4 2}
{cmd:editvalue(}{it:A}{cmd:,} {it:from}{cmd:,} {it:to}{cmd:)}
and
{cmd:_editvalue(}{it:A}{cmd:,} {it:from}{cmd:,} {it:to}{cmd:)}
abort with error if {it:from} and {it:to} are incompatible with {it:A}. That
is, if {it:A} is real, {it:to} and {cmd:from} must be real. If {it:A} is
complex, {it:to} and {it:from} must each be either real or complex. If {it:A}
is string, {it:to} and {it:from} must be string.
{p 4 4 2}
{cmd:_editvalue(}{it:A}{cmd:,} {it:from}{cmd:,} {it:to}{cmd:)}
aborts with error if {it:A} is a view.
{title:Source code}
{p 4 4 2}
{view editvalue.mata, adopath asis:editvalue.mata};
{cmd:_editvalue()} is built-in.
{title:Also see}
{p 4 13 2}
Manual: {hi:[M-5] editvalue()}
{p 4 13 2}
Online: help for
{bf:{help mf_editmissing:[M-5] editmissing()}};
{bf:{help m4_manipulation:[M-4] manipulation}}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -