[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Catching up to Matlab
From: |
Sergei Steshenko |
Subject: |
Re: Catching up to Matlab |
Date: |
Mon, 1 Nov 2010 07:52:00 -0700 (PDT) |
--- On Mon, 11/1/10, Jordi Gutiérrez Hermoso <address@hidden> wrote:
> From: Jordi Gutiérrez Hermoso <address@hidden>
> Subject: Catching up to Matlab
> To: "Sergei Steshenko" <address@hidden>
> Cc: "Ben Abbott" <address@hidden>, address@hidden
> Date: Monday, November 1, 2010, 6:00 AM
> On 1 November 2010 00:11, Sergei
> Steshenko <address@hidden>
> wrote:
> > So, could Octave developers just publish a list of all
> Matlab functions
> > with 'v' attached to the implemented ones ? As I've
> said, I hope I'll be
> > able to look up what I need in Matlab documentation.
>
> http://octave.sourceforge.net/functions_by_alpha.php
>
Huh ?
How do I know which of the functions exists both in Octave and Matlab,
and which function is Octave-specific, and which Matlab functions haven't
been implemented yet ?
Now, a practical example:
http://octave.sourceforge.net/octave/function/set.html :
"
Built-in Function: set (h, property, value, ...)
Built-in Function: set (h, properties, values)
Built-in Function: set (h, pv)
Set named property values for the graphics handle (or vector of graphics
handles) h. There are three ways how to give the property names and values:
* as a comma separated list of property, value pairs
Here, each property is a string containing the property name, each
value is a value of the appropriate type for the property.
* as a cell array of strings properties containing property names and a
cell array values containing property values.
In this case, the number of columns of values must match the number
of elements in properties. The first column of values contains values for the
first entry in properties etc.. The number of rows of values must be 1 or match
the number of elements of h. In the first case, each handle in h will be
assigned the same values. In the latter case, the first handle in h will be
assigned the values from the first row of values and so on.
* as a structure array pv
Here, the field names of pv represent the property names, and the
field values give the property values. In contrast to the previous case, all
elements of pv will be set in all handles in h independent of the dimensions of
pv.
"
vs
http://www.mathworks.com/help/techdoc/ref/set.html :
"set - Set Handle Graphics object properties
Syntax
set(H,'PropertyName',PropertyValue,...)
set(H,a)
set(H,pn,pv,...)
set(H,pn,MxN_pv)
a = set(h)
pv = set(h,'PropertyName')
Description
Note Do not use the set function on Java objects as it will cause a
memory leak. For more information, see Accessing Private and Public Data
set(H,'PropertyName',PropertyValue,...) sets the named properties to the
specified values on the object(s) identified by H. H can be a vector of
handles, in which case set sets the properties' values for all the objects.
set(H,a) sets the named properties to the specified values on the object(s)
identified by H. a is a structure array whose field names are the object
property names and whose field values are the values of the corresponding
properties.
set(H,pn,pv,...) sets the named properties specified in the cell array pn to
the corresponding value in the cell array pv for all objects identified in H.
set(H,pn,MxN_pv) sets n property values on each of m graphics objects, where m
= length(H) and n is equal to the number of property names contained in the
cell array pn. This allows you to set a given group of properties to different
values on each object.
a = set(h) returns the user-settable properties and possible values for the
object identified by h. a is a structure array whose field names are the
object's property names and whose field values are the possible values of the
corresponding properties. If you do not specify an output argument, the MATLAB
software displays the information on the screen. h must be scalar.
pv = set(h,'PropertyName') returns the possible values for the named property.
If the possible values are strings, set returns each in a cell of the cell
array pv. For other properties, set returns a statement indicating that
PropertyName does not have a fixed set of property values. If you do not
specify an output argument, MATLAB displays the information on the screen. h
must be scalar.
Remarks
You can use any combination of property name/property value pairs, structure
arrays, and cell arrays in one call to set.
Setting Property Units
Note that if you are setting both the FontSize and the FontUnits properties in
one function call, you must set the FontUnits property first so that the MATLAB
software can correctly interpret the specified FontSize. The same applies to
figure and axes uints — always set the Units property before setting properties
whose values you want to be interpreted in those units. For example,
f = figure('Units','characters',...
'Position',[30 30 120 35]);
Examples
Set the Color property of the current axes to blue.
axes;
set(gca,'Color','b')
Change all the lines in a plot to black.
plot(peaks)
set(findobj('Type','line'),'Color','k')
You can define a group of properties in a structure to better organize your
code. For example, these statements define a structure called active, which
contains a set of property definitions used for the uicontrol objects in a
particular figure. When this figure becomes the current figure, MATLAB changes
the colors and enables the controls.
active.BackgroundColor = [.7 .7 .7];
active.Enable = 'on';
active.ForegroundColor = [0 0 0];
if gcf == control_fig_handle
set(findobj(control_fig_handle,'Type','uicontrol'),active)
end
You can use cell arrays to set properties to different values on each object.
For example, these statements define a cell array to set three properties,
PropName(1) = {'BackgroundColor'};
PropName(2) = {'Enable'};
PropName(3) = {'ForegroundColor'};
These statements define a cell array containing three values for each of three
objects (i.e., a 3-by-3 cell array).
PropVal(1,1) = {[.5 .5 .5]};
PropVal(1,2) = {'off'};
PropVal(1,3) = {[.9 .9 .9]};
PropVal(2,1) = {[1 0 0]};
PropVal(2,2) = {'on'};
PropVal(2,3) = {[1 1 1]};
PropVal(3,1) = {[.7 .7 .7]};
PropVal(3,2) = {'on'};
PropVal(3,3) = {[0 0 0]};
Now pass the arguments to set,
set(H,PropName,PropVal)
where length(H) = 3 and each element is the handle to a uicontrol.
Setting Different Values for the Same Property on Multiple Objects
Suppose you want to set the value of the Tag property on five line objects,
each to a different value. Note how the value cell array needs to be transposed
to have the proper shape.
h = plot(rand(5));
set(h,{'Tag'},{'line1','line2','line3','line4','line5'}')
See Also
findobj, gca, gcf, gco, gcbo, get
Graphics Object Identification for related functions
",
so from Octave documentation how do I at all know in the first place
that 'set' exists in Matlab ?
--Sergei.
- Catching up to Matlab, Jordi Gutiérrez Hermoso, 2010/11/01
- Re: Catching up to Matlab,
Sergei Steshenko <=
- Re: Catching up to Matlab, Jordi Gutiérrez Hermoso, 2010/11/01
- Re: Catching up to Matlab, Judd Storrs, 2010/11/01
- Re: Catching up to Matlab, Sergei Steshenko, 2010/11/02
- Re: Catching up to Matlab, John W. Eaton, 2010/11/02
- Re: Catching up to Matlab, Sergei Steshenko, 2010/11/04
- Re: Catching up to Matlab, Jaroslav Hajek, 2010/11/14
- Re: Catching up to Matlab, Sergei Steshenko, 2010/11/15
- Re: Catching up to Matlab, Jordi Gutiérrez Hermoso, 2010/11/15
- Re: Catching up to Matlab, Ozzy Lash, 2010/11/15
- Re: Catching up to Matlab, Sergei Steshenko, 2010/11/16