SUBSASGN

From Jacket Wiki

Jump to: navigation, search
Back to Function List

Subscripted assignment

Usage

Jacket for M Language
    Supported Syntax
    
A = subsasgn(A,S,B)
A(A > .5) = a
A(1:5) = a
A(1:5) = 0
A(1:5) = 1:5
A(2,3) = NaN
A(idx) = [] % where idx is sorted
    

GFOR Supported

Yes

GCOMPILE Supported

No

Types Supported

-  GDOUBLE   GSINGLE   GLOGICAL   GINT32   INT8   GUINT32   GUINT8   COMPLEX 

Types Not Supported

-

CPU usageJacket only contains GPU computing functions. To run functions on the CPU, try one of the MathWorks products:
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/subsasgn.html

Notes

Known issue: subscript assignment using a boolean mask and CPU scalar into a field or cell array results in a double-free within the MATLAB runtime. The work around is to cast the CPU scalar to gsingle()

  A.field(A.field > .5) = 4;  % will fail
  A.field(A.field > .5) = gsingle(4);  % will work
  • A = subsasgn(A,S,B) is called internally by MATLAB for the syntax A(i) = B(i), A{i} = B, or A.i = B
>> A = grand(4)
A =
    0.6206    0.8232    0.7425    0.7810
    0.5977    0.6119    0.1391    0.0675
    0.0493    0.4752    0.0558    0.4507
    0.5730    0.0074    0.5251    0.4150
>> A(1:3,2:4) = 7.7777
A =
    0.6206    7.7777    7.7777    7.7777
    0.5977    7.7777    7.7777    7.7777
    0.0493    7.7777    7.7777    7.7777
    0.5730    0.0074    0.5251    0.4150

See Also

SUBSREF, SUBSTRUCT

Personal tools