Difference between revisions of "Matlab cell array"

From Dynamo
Jump to navigation Jump to search
Line 4: Line 4:
  
 
== Basic syntax ==
 
== Basic syntax ==
A complete description can be found in the [ https://uk.mathworks.com/help/matlab/cell-arrays.html | matlab page]
 
  
Some basic example
+
 
 +
Some basic examples:
 +
 
 
<tt>a = {}</tt>
 
<tt>a = {}</tt>
  
Line 12: Line 13:
  
 
<tt>a = {'hello','bye'}; </tt>
 
<tt>a = {'hello','bye'}; </tt>
creates a cell array that contains the strings <tt>hello</tt> and <tt>bye</tt>
+
creates a cell array that contains the strings <tt>hello</tt> and <tt>bye</tt>, so that
  
 +
<tt>disp(a{1});</tt>
 +
will just write the string <tt>hello</tt> in the Matlab desktop ( or in the ''Dynamo'' standalone console).
 +
 +
Individual elements can be added through the <tt>{}</tt>notation:
 +
 +
<tt>a{3} = 'hi again';</tt>
 +
 +
will enlarge the cell array  with a third element.
 +
 +
 +
A complete description can be found in the [https://uk.mathworks.com/help/matlab/cell-arrays.html |matlab page]
  
 
== Cell arrays in ''Dynamo'' ==
 
== Cell arrays in ''Dynamo'' ==
Line 19: Line 31:
  
 
=== Operating of models ===
 
=== Operating of models ===
 +
 +
  
 
=== Extracting model files from a catalogue ===  
 
=== Extracting model files from a catalogue ===  
 
The names of the model files in a catalogue can be easily extracted with the command line <tt>dcm</tt> utility
 
The names of the model files in a catalogue can be easily extracted with the command line <tt>dcm</tt> utility

Revision as of 12:35, 2 February 2017

The cell array is a Matlab container for the storage of series of objects in the memory workspace. Individuals elements are accessed or created with the curly bracket {} notation. Cell arrays are available both in Matlab and in the standalone versions of Dynamo.


Basic syntax

Some basic examples:

a = {}

creates an empty cell array called a in the memory workspace.

a = {'hello','bye'}; creates a cell array that contains the strings hello and bye, so that

disp(a{1}); will just write the string hello in the Matlab desktop ( or in the Dynamo standalone console).

Individual elements can be added through the {}notation:

a{3} = 'hi again';

will enlarge the cell array with a third element.


A complete description can be found in the |matlab page

Cell arrays in Dynamo

Cell arrays are frequently of interest for Dynamo users that need to perform operations that are complicated or not available through the GUIs.

Operating of models

Extracting model files from a catalogue

The names of the model files in a catalogue can be easily extracted with the command line dcm utility