From 526cf222d60520cbfccab6f3a4636e15c031335c Mon Sep 17 00:00:00 2001 From: Jan Grewe Date: Mon, 16 Oct 2017 22:33:42 +0200 Subject: [PATCH] [programming] fix translations in m-files --- programming/code/ifelse.m | 2 +- programming/code/logicalVector.m | 12 ++++++------ programming/code/vectorsize.m | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/programming/code/ifelse.m b/programming/code/ifelse.m index 1d689f4..6cc94e5 100644 --- a/programming/code/ifelse.m +++ b/programming/code/ifelse.m @@ -1,4 +1,4 @@ -x = rand(1); % eine einzelne Zufallszahl +x = rand(1); % draw a single random number if x < 0.5 disp('x is less than 0.5'); end diff --git a/programming/code/logicalVector.m b/programming/code/logicalVector.m index 33db329..97a4918 100644 --- a/programming/code/logicalVector.m +++ b/programming/code/logicalVector.m @@ -1,12 +1,12 @@ x = 1:10; -%% Erstellen eines logischen Vektors +%% creating a logical vector y = x < 5; -fprintf('Logischer Vektor y:\n'); +fprintf('Logical vector y:\n'); y -fprintf('Datentyp von y: %s\n', class(y)); +fprintf('Data type of y: %s\n', class(y)); -%% Auswahl aller Element, die kleiner 5 sind -fprintf('\nAlle Elemente aus x, die kleiner als 5 sind:\n') +%% Select all elements that are less than 5 +fprintf('\nAll elemente of x that are less than 5:\n') -x(y) \ No newline at end of file +x(y) diff --git a/programming/code/vectorsize.m b/programming/code/vectorsize.m index 40996dc..26ebfd5 100644 --- a/programming/code/vectorsize.m +++ b/programming/code/vectorsize.m @@ -1,4 +1,4 @@ -a = [2 4 6 8 10]; % Zeilenvektor mit 5 Elementen -s = size(a) % Speicher den Rueckgabewert von size() in einer Variablen -s(2) % Inhalt der zweiten Zahl, d.h. Laenge der 2. Dimension -size(a,2) % Die kurze Alternative +a = [2 4 6 8 10]; % row vector with five elements +s = size(a) % store the return value of size() in a new variable +s(2) % get the second element of s, i.e. the length along the 2nd dimension +size(a,2) % the shortcut