Mercurial > hg > ltpda
view m-toolbox/html_help/help/ug/objects_working.html @ 27:29276498ebdb database-connection-manager
Remove LTPDARepositoryManager implementation
* * *
Remove GUI helper
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> <html lang="en"> <head> <meta name="generator" content= "HTML Tidy for Mac OS X (vers 1st December 2004), see www.w3.org"> <meta http-equiv="Content-Type" content= "text/html; charset=us-ascii"> <title>Working with LTPDA objects (LTPDA Toolbox)</title> <link rel="stylesheet" href="docstyle.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.52.2"> <meta name="description" content= "Presents an overview of the features, system requirements, and starting the toolbox."> </head> <body> <a name="top_of_page" id="top_of_page"></a> <p style="font-size:1px;"> </p> <table class="nav" summary="Navigation aid" border="0" width= "100%" cellpadding="0" cellspacing="0"> <tr> <td valign="baseline"><b>LTPDA Toolbox</b></td><td><a href="../helptoc.html">contents</a></td> <td valign="baseline" align="right"><a href= "objects_create.html"><img src="b_prev.gif" border="0" align= "bottom" alt="Creating LTPDA Objects"></a> <a href= "ao_intro.html"><img src="b_next.gif" border="0" align= "bottom" alt="Analysis Objects"></a></td> </tr> </table> <h1 class="title"><a name="f3-12899" id="f3-12899"></a>Working with LTPDA objects</h1> <hr> <p> <p> The use of LTPDA objects requires some understanding of the nature of objects as implemented in MATLAB. </p> <p> For full details of objects in MATLAB, refer to <a href="matlab:web(['jar:file:///' matlabroot '/help/techdoc/help.jar!/matlab_oop/ug_intropage.html'])">MATLAB Classes and Object-Oriented Programming</a>. For convenience, the most important aspects in the context of LTPDA are reviewed below. </p> <p> <ul> <li> <p><a href="objects_working.html#calling">Calling object methods</a></p> </li> <li> <p><a href="objects_working.html#set">Setting object properties</a></p> </li> <li> <p><a href="objects_working.html#copy">Copying objects</a></p> </li> <li><a href="objects_working.html#exploring">Exploring objects</a></li> </ul> </p> <a name="calling" id= "calling"><h3 class="title">Calling object methods</h3></a> <p> Each class in LTPDA has a set of methods (functions) which can operate/act on instances of the class (objects). For example, the AO class has a method <tt>psd</tt> which can compute the Power Spectral Density estimate of a time-series AO. </p> <p> To see which methods a particular class has, use the <tt>methods</tt> command. For example, <div class="fragment"><pre> >> methods(<span class="string">'ao'</span>) </pre></div> </p> <p> To call a method on an object, <tt>obj.method</tt>, or, <tt>method(obj)</tt>. For example, <div class="fragment"><pre> >> b = a.psd </pre></div> or <div class="fragment"><pre> >> b = psd(a) </pre></div> Additional arguments can be passed to the method (a <tt>plist</tt>, for example), as follows: <div class="fragment"><pre> >> b = a.psd(pl) </pre></div> or <div class="fragment"><pre> >> b = psd(a, pl) </pre></div> </p><br> <p> In order to pass multiple objects to a method, you must use the form <div class="fragment"><pre> >> b = psd(a1, a2, pl) </pre></div> </p><br> <p> Some methods can behave as modifiers which means that the object which the method acts on is modified. To modify an object, just give no output. If we start with a time-series AO then modify it with the <tt>psd</tt> method, <div class="fragment"><pre> >> a = ao(1:100, randn(100,1), 10) >> a M: running ao/display ----------- ao 01: a ----------- name: None data: (0,0.840375529753905) (0.1,-0.88803208232901) (0.2,0.100092833139322) (0.3,-0.544528929990548) (0.4,0.303520794649354) ... -------- tsdata 01 ------------ fs: 10 x: [100 1], double y: [100 1], double dx: [0 0], double dy: [0 0], double xunits: [s] yunits: [] nsecs: 10 t0: 1970-01-01 00:00:01.000 ------------------------------- hist: ao / ao / SId: fromVals ... -->$Id: ao .... S mdlfile: empty description: UUID: 8cffab46-61f0-494a-af03-eb310aa76114 -------------------------------- </pre></div><br> Then call the <tt>psd</tt> method: <div class="fragment"><pre> >> a.psd M: running ao/psd M: running ao/len M: running ao/len M: running ao/display ----------- ao 01: PSD(a) ----------- name: PSD(a) data: (0,0.117412356146407) (0.1,0.179893990497347) (0.2,0.173957816470448) (0.3,0.245076068355785) (0.4,0.213036543621994) ... ----------- fsdata 01 ----------- fs: 10 x: [51 1], double y: [51 1], double dx: [0 0], double dy: [0 0], double xunits: [Hz] yunits: [Hz^(-1)] t0: 1970-01-01 00:00:01.000 navs: 1 --------------------------------- hist: ao / psd / SId: psd.m,v 1.52 2009/09/05 05:57:32 mauro Exp S mdlfile: empty description: UUID: 0d2395cd-22af-4645-a94c-69fa32c15982 ------------------------------------- </pre></div><br> then the object <tt>a</tt> is converted to a frequency-series AO. </p><br> <p> This modifier behaviour only works with certain methods, in particular, methods requiring more than one input object will not behave as modifiers. </p><br> <a name="set" id= "set"><h3 class="title">Setting object properties</h3></a> <p> All object properties must be set using the appropriate setter method. For example, to set the name of a IIR filter object, <div class="fragment"><pre> >> ii = miir(); >> ii.setName(<span class="string">'My Filter'</span>); </pre></div> </p> <p> Reading the value of a property is achieved by: <div class="fragment"><pre> >> ii.name ans = My Filter </pre></div> </p><br> <a name="copy" id= "copy"><h3 class="title">Copying objects</h3></a> <br> <p> Since all objects in LTPDA are handle objects, creating copies of objects needs to be done differently than in standard MATLAB. For example, <div class="fragment"><pre> >> a = ao(); >> b = a; </pre></div> in this case, the variable <tt>b</tt> is a copy of the handle <tt>a</tt>, not a copy of the object pointed too by the handle <tt>a</tt>. To see how this behaves, <div class="fragment"><pre> >> a = ao(); >> b = a; >> b.setName(<span class="string">'My Name'</span>); >> a.name ans = My Name </pre></div> </p> <p> Copying the object can be achieved using the copy constructor: <div class="fragment"><pre> >> a = ao(); >> b = ao(a); >> b.setName(<span class="string">'My Name'</span>); >> a.name ans = none </pre></div> <p>In this case, the variable <tt>b</tt> points to a new distinct copy of the object pointed to by <tt>a</tt>. </p> </p> <p></p> <h3 class="title"><a name="exploring" id="calling2">Exploring objects</a></h3> <p> A browsing tool is provided on purpose to enable LTPDA objects exploring.</p> <p><a href="gui_explorer.html">See the LTPDA Objects Explorer GUI documentation.</a></p> </p> <br> <br> <table class="nav" summary="Navigation aid" border="0" width= "100%" cellpadding="0" cellspacing="0"> <tr valign="top"> <td align="left" width="20"><a href="objects_create.html"><img src= "b_prev.gif" border="0" align="bottom" alt= "Creating LTPDA Objects"></a> </td> <td align="left">Creating LTPDA Objects</td> <td> </td> <td align="right">Analysis Objects</td> <td align="right" width="20"><a href= "ao_intro.html"><img src="b_next.gif" border="0" align= "bottom" alt="Analysis Objects"></a></td> </tr> </table><br> <p class="copy">©LTP Team</p> </body> </html>