www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/ShrlibCreatePointerOffsetFromExistingLibpointerObjectExample.m

    %% Create Pointer Offset from Existing lib.pointer Object
% This example shows how to create a pointer to a subset of a MATLAB vector 
% |X|. The new pointer is valid only as long as the original pointer exists.
% 
% Create a pointer to a vector.

% Copyright 2015 The MathWorks, Inc.


X = 1:10;
xp = libpointer('doublePtr',X);
xp.Value
%% 
% Use the lib.pointer plus operator (|+|) to create a pointer to the last 
% six elements of |X|.

xp2 = xp + 4;
xp2.Value
%% 
%