Skip to content

Commit

Permalink
Add example.
Browse files Browse the repository at this point in the history
  • Loading branch information
HansOlsson committed Jul 7, 2023
1 parent 0e9191c commit f7b4d40
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions chapters/arrays.tex
Expand Up @@ -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}
Expand Down

0 comments on commit f7b4d40

Please sign in to comment.