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