About Site Map Submit Contact Us Log in | Create an account
Create an account Log In
Average Rating
User Rating:
Visitors Rating:
My rating:

Write review
See full specifications

scripts default iconPointers and subscript pointers (Scripts) Publisher's description

The hnum class is a handle to a value class (uint8, double, etc)

The hnum class is a handle to a value class (uint8, double, etc). It acts like a pointer, but isn't really a pointer. Operating on an hnum class does not require "x = x + 1". Using "x+1" will permanantly modify it's value. Copying an hnum object only creates a copy to it's handle, and doesn't copy it's data. In the example "y = x", if x changes, y also changes.

There are two subscripting modes for the hnum class. The default is 'normal'. In the normal mode, "a = x(1:3)" returns a value, not a handle. In the 'pointer' mode, "a = x(1:3)" returns a pointer to the first three
elements of x. This is a subscripthandle class. Modifying 'a' modifies the elements of 'x' that 'a' points to.

Some things to try
x = hnum(magic(5),'pointer') %a magic square that returns pointers when subscripted
a = x(5:7) %Creates a pointer to part of x
a(:) = sin(a) %This changes some values of x. note: a = sin(a) returns a double
a(1:end) = 500 %Subscripting subscript handles is also valid

Most of the functions of both classes were generated using a macro function. This was done to save time, as there are 100+ functions to overload. Because of this, not all functions allow as many inputs as their builtin versions. Some of the builtin functions were left out because they needed more than 2 inputs. See the two files in the 'Macro' directory for more information.

Watch out for memory leaks. Always delete an hnum object before replacing it.
x = hnum(1)
a = x(a)
x = 5 % This does not delete what 'x' used to be. Use delete(x) before.
a % 'a' keeps the previous x in memory even though you can't access it.

System Requirements:

MATLAB 7.11 (2010b)
Program Release Status: New Release
Program Install Support: Install and Uninstall

Pointers and subscript pointers (Scripts) Tags:

Click on a tag to find related softwares

Is Pointers and subscript pointers (Scripts) your software?

Manage your software

Most Popular

scripts default icon ASK, OOK, FSK, BPSK, QPSK, 8PSK modulation 1.1
ASK, OOK, FSK, BPSK, QPSK, 8PSK modulation contain several functions for digital modulation simulation
scripts default icon Simulink Communication Labs 1.1
Simulink Communication Labs allows you to learn communication systems in greater depth.
scripts default icon M-QAM modulation and demodulation 1.1
M-QAM modulation and demodulation is the QAM modulation and demodulation tech.
scripts default icon LZW Compression/Decompression 1.1
LZW Compression/Decompression - Updated LZW compressor and decompressor with reasonable performance
scripts default icon InSPIRE utility to plot a 2D displacement field (Scripts) 1.0
This program plots the deformation field (displace vectors) contained in vector.txt.