Biomodèles/Biomodels
SCILAB 3.0 PAS A PAS
SCILAB 3.0 STEP-TO-STEP

Jacques-Deric Rouault

Laboratoire de Neurobiologie de l'Apprentissage, de la Mémoire et de la Communication. CNRS UMR 8620, Bat. 446, Université Paris-Sud, F91400 Orsay

Orscilab
ORSCILAB

17 VECTEURS, MATRICES ET HYPERMATRICES
17 VECTORS, MATRICES AND HYPERMATRICES
17.2 Gestion des éléments / Managing elements
Version 2.1.2 du 4 Fevrier 2005 / Version 2.1.2, February 4th 2005
Biomodèles/Biomodels N°1 pp 0x-0y Décembre 2004 December 2004

Retour à la Table générale / Return to the General table
Index général / General index
Passage à la section suivante 17.3 / Next section 17.3

a
Eléments (Matrice)
Elements (Matrix)
() (Matrice, Matrix)
, (Matrice, Matrix)

b
Rangement des éléments d'une matrice
Storage of the elements of a matrix

c
Extension d'une matrice
Expanding a matrix

d
$ (Matrice, Matrix)
Dernier élément d'une matrice
Last element of a matrix


Les éléments d'une matrice sont désignés à l'aide des parenthèses et des virgules
The elements of a matrix are designed with parenthesis and commas.

// PROGRAMME SPAS170201
m = [1, 2; 3, 4];
m (1,2) = 5;
m,

Ch17Sc02-Fig01

Il est possible d'accéder directement à un élément par son rang de rangement en mémoire centrale : les éléments sont rangés colonne par colonne, en ordre inverse de leur désignation. Cette approche n'est pas conseillée. Voir les fonctions sub2ind et ind2sub.
It is possible to directly access to an element by its ranking order in central memory: elements are stored column by column, in the reverse order of their naming. This approach is not recommended. See the functions sub2ind and ind2sub.

// PROGRAMME SPAS170202
m = [1, 2, 3; 4, 5, 6];
print (%io(2), m(5), m(3), m(1)) ;
print (%io(2), m(6), m(4), m(2)) ;

Ch17Sc02-Fig02

Si on désigne un élément d'une matrice extérieur à la taille déclarée,  la matrice est automatiquement agrandie.
If an element exterior to the declared matrix is designed, the matrix is automatically expanded.


// PROGRAMME SPAS170203
m = [1, 2, 3; 4, 5, 6];
m (5,5) = 10;
m,

Ch17Sc02-Fig03

Le dernier élément d'une dimension est désigné par $.
The last element of a dimension is designed by $.

// PROGRAMME SPAS170204
m = [1, 2, 3; 4, 5, 6];
m ($,$),

Ch17Sc02-Fig04

Cette notation permet de créer directement à l'élement suivant.
This notation allows the direct creation of the next one element.

// PROGRAMME SPAS170205
m = [1, 2, 3; 5, 6, 7];
m (1,$+1) = 4;
m (2,4) = 8;
m,

Ch17Sc02-Fig05

Retour à la Table générale / Return to the General table
Index général / General index
Passage à la section suivante 17.3 / Next section 17.3