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
  • Last update: 5 years ago
  • Total downloads: 68
  • Operating system: Linux, Mac OS X, Win All, BSD, Solaris
  • Publisher: Matt J (15 other programs)
See full specifications

scripts default iconOverloading SIZE for Array-like User-Defined Objects (Scripts) Publisher's description

parseSize - a function to aid OOP overloading of the size() method in user-defined classes

parseSize - a function to aid OOP overloading of the size() method in user-defined classes. If the user provides the vector of dimensions of a hypothetical array object, parseSize will take care of the main input/output argument processing in a way that imitates the conventions of MATLAB's usual SIZE function.

EXAMPLE: consider the following class and notice how parseSize is used to implement the SIZE method in a single line,

В В В В В classdef myClass
В В В В В В В В В В properties
В В В В В В В В В В В В В В dimension
В В В В В В В В В В end % properties

В В В В В В В В В В methods
В В В В В В В В В В В В В В function varargout=size(obj,varargin)
В В В В В В В В В В В В В В В В В В varargout=parseSize(obj.dimension,nargout,varargin{:});
В В В В В В В В В В В В В В end
В В В В В В В В В В end
В В В В В В end

In the next several examples, we see that all of the same calling syntaxes as for the usual MATLAB size() function are now enabled for this class:

>> obj=myClass; obj.dimension=[3,5,4,1];

>> [m,n,p,q,r,s]=size(obj); [m,n,p,q,r,s]

ans =

3 5 4 1 1 1

>> [m,n]=size(obj); [m,n]

ans =

3 20

>> s=size(obj)

s =

3 5 4

>> s2=size(obj,2)

s2 =





dimensions: A vector specifying the dimensions of a hypothetical array-like
object. Trailing ones are permitted.

numargsout: The number of requested outputs in a call to the class'
size method, e.g., for [m,n,p]=size(obj) a value of
numargsout=3 should be passed to parseSize.

dim: if the calling syntax to the class's size method is size(obj,i),
one would pass dim=i to parseSize.


argsout: a cell array to be passed as the varargout of the size method.

System Requirements:

MATLAB 7.9 (2009b)
Program Release Status: New Release
Program Install Support: Install and Uninstall

Overloading SIZE for Array-like User-Defined Objects (Scripts) Tags:

Click on a tag to find related softwares

Is Overloading SIZE for Array-like User-Defined Objects (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.