|
From: | Yoel Callev |
Subject: | Re: matrix with 3 indices |
Date: | Tue, 16 Jul 2002 15:33:48 +0300 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2.1) Gecko/20010901 |
scherer wrote:
Dear Sir I am using OCTAVE as a programming language in a course on computational methos of Physics. At the moment I am teaching molecular dynamics: on a rectangular lattice of cells I need two indices to specify each cell and a third index to enumerate the atoms in the cell. In MATLAB I would simply create a matrix A with elements A(i, j, k), but this feature is apparently not suported by OCTAVE. Is there an alternative? Thanks for your answer. Claudio Scherer
You can use cells: A{k}(i,j).This way different cells (k's) can contain matrices of different sizes, and these matrices can still be multiplied.
You can allocate such arrays with cell(size), and read about it on the MATLAB help under 'cell arrays', athough I havn't found any reference in Octave's help file, this feature does exists in Octave.
-Yoel Callev (femto.tau.ac.il/~yoel) ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------
[Prev in Thread] | Current Thread | [Next in Thread] |