From f7b4d405ee50e950b9d062a1a5ea6ba638061a34 Mon Sep 17 00:00:00 2001 From: HOS Date: Fri, 7 Jul 2023 14:05:52 +0200 Subject: [PATCH] Add example. --- chapters/arrays.tex | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/chapters/arrays.tex b/chapters/arrays.tex index 5da79766c..f8d65169e 100644 --- a/chapters/arrays.tex +++ b/chapters/arrays.tex @@ -976,6 +976,10 @@ \section{Indexing}\label{array-indexing}\label{indexing} v[{j, k}] := {2, 3}; // Same as: v[j] := 2; v[k] := 3; v[{1, 1}] := {2, 3}; // Same as: v[1] := 3; \end{lstlisting} +Array indexing of general expression: +\begin{lstlisting}[language=modelica] +(a*a)[:, j] // Vector of the j'th column of a*a +\end{lstlisting} If \lstinline!x! is a vector, \lstinline!x[1]! is a scalar, but the slice \lstinline!x[1:5]! is a vector (a vector-valued or colon index expression causes a vector to be returned). \end{example}