[debugging] several changes

This commit is contained in:
Jan Grewe 2017-10-21 16:21:25 +02:00
parent bd446b8c0c
commit 3aae7a94d9

View File

@ -96,27 +96,27 @@ ans =
65 % wtf ?!? 65 % wtf ?!?
\end{lstlisting} \end{lstlisting}
The first two indexing attempts in listing \ref{indexerror_listing} The first two indexing attempts in listing \ref{indexerror} are rather
are rather clear. We are trying to access elements with indices that clear. We are trying to access elements with indices that are
are invalid. Remember, indices in \matlab{} start with 1. Negative invalid. Remember, indices in \matlab{} start with 1. Negative numbers
numbers and zero are not permitted. In the third attemp we index and zero are not permitted. In the third attemp we index using a
using a floating point number. This fails because indices have to be floating point number. This fails because indices have to be 'integer'
'integer' values. Using a character as an index (fourth attempt) values. Using a character as an index (fourth attempt) leads to a
leads to a different error message that says that the index exceeds different error message that says that the index exceeds the matrix
the matrix dimensions. This indicates that we are trying to read data dimensions. This indicates that we are trying to read data behind the
behind the length of our variable \codevar{my\_array} which has 100 length of our variable \codevar{my\_array} which has 100 elements.
elements.
One could have expected that the character is an invalid index, but One could have expected that the character is an invalid index, but
apparently it is valid but simply too large. The fith attempt apparently it is valid but simply too large. The fith attempt finally
finally succeeds. But why? \matlab{} implicitely converts the succeeds. But why? \matlab{} implicitely converts the \codeterm{char}
\codeterm{char} to a number and uses this number to address the to a number and uses this number to address the element in
element in \varcode{my\_array}. \varcode{my\_array}. The \codeterm{char} has the ASCII code 65 and
thus the 65th element of \varcode{my_array} is returned.
\subsection{\codeterm{Assignment error}} \subsection{\codeterm{Assignment error}}
This error occurs when we want to write data into a vector. This error occurs when we want to write data into a vector.
\paragraph{Name error:} \subsection{Name error}
\paragraph{Arithmetic error:} \subsection{Arithmetic error}
\section{Logical error} \section{Logical error}
Sometimes a program runs smoothly and terminates without any Sometimes a program runs smoothly and terminates without any