Difference between revisions of "General Behaviour"

From LIBISIS
Jump to navigation Jump to search
Line 1: Line 1:
 +
Some general behaviour is shared by many different functions
 +
 
==Arrays of Datasets==
 
==Arrays of Datasets==
 +
 +
If an array of datasets is given then the operation is performed on each dataset in turn, so that
 +
 +
<pre>>> wwout = func(ww, params)</pre>
 +
 +
where wwout and ww are arrays of datasets and params are the parameters required by the function func, is the equivilent of
 +
 +
<pre>for i = 1:length(ww)
 +
    wwout(i) = func(ww(i), params)
 +
end</pre>
 +
 +
If all of the parameters are arrays of the same length as the dataset then for some functions this will be equivilent to
 +
 +
<pre>for i = 1:length(ww)
 +
    wwout(i) = func(ww(i), params(i)
 +
end</pre>
 +
 +
See the matlab online help on individual functions for information on whether they use this syntax.
 +
  
 
==Property-Value Pairs==
 
==Property-Value Pairs==
 +
Some functions, particularly those in the [[User Manual#Graphics|Graphics]] package have many optional independent input parameters. Property-value pairs are used to set these.
 +
 +
<pre>>> func(input1, input2, ... 'Property', value, 'Property2', value2, ...)</pre>
 +
 +
* Properties are always strings that indicate which property will be set
 +
* Values must be in the correct format for the property being set. For instance, if the property is a size, then the value should be a number, but if the property is a label then the value should be a string
 +
* Property-value pairs may be given in any order or omitted
 +
* Property-value pairs are always the final set of arguments to a function
 +
  
 
==Naming of Functions==
 
==Naming of Functions==
 +
 +
  
 
talk about _x, _y, _xy convention etc. etc.  
 
talk about _x, _y, _xy convention etc. etc.  
Line 13: Line 45:
 
==Name Tags==
 
==Name Tags==
  
See [[Using Name Tags]] for more information
+
See [[Using Default Properties and Name Tags]] for more information

Revision as of 09:28, 19 March 2008

Some general behaviour is shared by many different functions

Arrays of Datasets

If an array of datasets is given then the operation is performed on each dataset in turn, so that

>> wwout = func(ww, params)

where wwout and ww are arrays of datasets and params are the parameters required by the function func, is the equivilent of

for i = 1:length(ww)
    wwout(i) = func(ww(i), params)
end

If all of the parameters are arrays of the same length as the dataset then for some functions this will be equivilent to

for i = 1:length(ww)
    wwout(i) = func(ww(i), params(i)
end

See the matlab online help on individual functions for information on whether they use this syntax.


Property-Value Pairs

Some functions, particularly those in the Graphics package have many optional independent input parameters. Property-value pairs are used to set these.

>> func(input1, input2, ... 'Property', value, 'Property2', value2, ...)
  • Properties are always strings that indicate which property will be set
  • Values must be in the correct format for the property being set. For instance, if the property is a size, then the value should be a number, but if the property is a label then the value should be a string
  • Property-value pairs may be given in any order or omitted
  • Property-value pairs are always the final set of arguments to a function


Naming of Functions

talk about _x, _y, _xy convention etc. etc.

Order of Inputs

things like, the dataset always comes first, then any x transformation, then any y transformation.

Name Tags

See Using Default Properties and Name Tags for more information