Tricks Programme
Tricks Programme
Generell
Word
Shortcuts
Tabelle 1: Shortcuts für Formatvorlagen der FH
Shortcut Formatvorlage
[Alt] + [1] Überschrift 1
[Alt] + [2] Überschrift 2
[Alt] + [3] Überschrift 3
[Alt] + [4] Überschrift 4
[Alt] + [5] Überschrift 5
[Alt] + [T] FH-Titel für Verzeichnisse
[Strg] + [T] FH-Beschriftung für Tabellen
[Alt] + [B] FH-Beschriftung für Bildunterschrift
[Alt] + [R] FH-Beschriftung für Formel
[Alt] + [F] FH-Fließtext
[Alt] + [O] FH-Fließtext ohne nachfolgenden Abstand
[Alt] + [M] FH-Fließtext mit vorhergehendem Abstand
[Alt] + [P] FH-Strich für Aufzählungen
[Alt] + [C] FH-Größer-als-Zeichen für Aufzählungen zweiter Ordnung
[Alt] + [Z] FH-Zitat für mehr als dreizeilige wörtliche Zitate
Alles markieren: Strg A
Aktualisieren: StrA-F9
Formattierung:
Geschütztes Leerzeichen: Shift+Strg -> Leerzeichen
Inhaltsverzeichnis
Powerpoint
Kurzbefehle
Hochgestellt: auswählen betroffene Zeichen -
gleichzeitig STRG, UMSCHALT und Pluszeichen (+)
Formatierung
Bilder von Text umfließen lassen: Einfügen –
Objekt – Microsoft Word Dokument -> in Fenster ist Word Programm
Exel
Rechnungen
Dropdown-Auswahlliste: Zelle markieren – Daten – Datenüberprüfung –
4567890tellungen – Liste – x;y;z oder $[Spalte]§[Zeile];…; $
[Spalte]§[Zeile]: $[Spalte]§[Zeile]
Verweis:
SVerweis(Suchkriterium; Matrix; Spaltenindex nach rechts (beginnend
mit 1))
XVerweis nach links oder INDEX(Matrix mit Index;
VERGLEICH(Suchkriterium; Matrix zur Suche; 0 für exakte
Übereinstimmung, 1: Suchwert < Matrixwerte, -1: Suchwert >
Matrixwerte)
Logische Funktionen:
WENN(Kriterium; Dann; Sonst): Maxima und Minima von Wellenfunktionen finden
:
=INDEX(J$24:J$1071;
KKLEINSTE(WENN(J$24:J$1071<J$25:J$1072;WENN(J$26:J$1073<J$25:J$1072;Z
EILE(§25:§1072)));ZEILE(J§25))) -> sucht in Matrix Zeile und gibt
Wert zurück wie folgt: Rang der kleinsten Zahl gesucht: wenn J24<J25,
DANN vergleiche: wenn J26<J25, DANN nimm diese Zeile als lok. Maximum
(sucht nacheinander alle Zeilen in Spalte ab)
Zelle fixieren bei „Rüberziehen“ von Funktionen: $A$1: Zelle fixiert - $A1:
Spalte fixiert – A$1: Zeile 1 fixiert
Formatierung
Fenster/Zeilen/Spalten einfrieren: Spalten/Zeilen auswählen – Ansicht
(Fenster) – Fenster einfrieren/erste Spalte/Zeile einfrieren
VBA:
.Activate und .Select: Nicht nutzen!
.activate: Fenster zu fixieren, Zoom einstellen
.Select: Diagramm-Series formattieren?
Autostart:
Sub VBE_starten()
With [Link]
.SetFocus
.Visible
End With
End Sub
Call [Function]
Arrays:
Ansprechen:
Buchstaben: Range(„B1:B“&Variable)
Zahlen: Cells(2,1),cells(4,5) oder Cells(=CODE("B)-CODE("A")+1,x)
Umwandeln Buchstabe -> Zahl:
Function strBuchstabe()
Dim strBuchstabe As String, intNummer As Integer
strBuchstabe = "AA"
If Len(strBuchstabe) = 1 Then
intNummer = Asc(strBuchstabe) - 64
Else
intNummer = (Asc(Left(strBuchstabe, 1)) - 64) * 26
intNummer = intNummer + Asc(Right(strBuchstabe, 1)) - 64
End If
MsgBox CStr(intNummer)
End Function
Umwandeln Zahl -> Buchstabe
Function spBuchstabe(spalte As Long) As String
Dim rg As String
Erstellen:
size_A=[Link](Worksheets(x).colums(y))
ReDim [A()]
For i = 1 To size_A
A(i) = Cells(i + z, 1).Value
Next i
Größe anpassen: Redim A (size_A)
Kontrolle: MsgBox UBound(A) -> Ausgabe des letzten Zeilenindex des
Arrays A
Zeilen und Spalten des Arrays zaehlen: UBound
Dim arr(1 To 4, 1 To 3) As Variant
[Link] UBound(arr, 1) '◄ returns 4
[Link] UBound(arr, 2) '◄ returns 3
Anwählen:
Buchstaben in Zellen: Left/right([Link]("A1"),3) & "."
Worksheets erst aktivieren: With [Link](x).Activate
ODER: [Link]
With wsx
'Ein Tabellenblatt aktivieren
Worksheets("München").Activate
Bildschirmaktualisierung Ein/Aus:
[Link] = True/False
Code:
Zeilenumbruch: LEERZEICHEN_
Countif:
Alle mit mind.1 Zeichen: =COUNTIF(A1:A11,”?*”)
Alle nicht leeren (Zeichen, Logikwerte): =COUNTIF(A1:A11,”?*”) +
SUMPRODUCT(–(ISLOGICAL(A1:A11))
Cell Types:
xlCellTypeAllFormatConditions -4172 Zellen mit beliebigem Format
xlCellTypeAllValidation -4174 Zellen mit Gültigkeitskriterien
xlCellTypeBlanks 4 Leere Zellen
xlCellTypeComments -4144 Zellen mit Anmerkungen
xlCellTypeConstants 2 Zellen mit Konstanten
xlCellTypeFormulas -4123 Zellen mit Formeln
xlCellTypeLastCell 11 Die letzte Zelle im verwendeten Bereich
xlCellTypeSameFormatConditions -4173 Zellen mit gleichem Format
xlCellTypeSameValidation -4175 Zellen mit gleichen
Gültigkeitskriterien
xlCellTypeVisible 12 Alle sichtbaren Zellen
Datentypen:
Conversions:
String (Check: IsNumeric()
Integer: CInt -> Double: CDbl() -> Single: CSng() -> Decimal:
CDec() -> Date: CDate()
Numeric Value
String: Str() -> Date: CDate()
Hexadecimal: Hex2Dec(hexVal) <-> Dec2Hex(DecVal)
Diagramme:
Chart: Diagramm in Diagrammblatt
ChartObject: Eingebettettes Diagram
Als neues Blatt: Charts(1).Activate
With ws[Kerndaten]
Set rng1 = .Range(.Cells(Zeile Anfang, Spalte Anfang), .Cells(Zeile
Ende, Spalte Ende))
End With
Erzeugen:
[Link] After:=Worksheets("[letztes Blatt]")
Dim cht1 As Chart
Set cht1 =Worksheets(x).ChartObjects(2).Chart
With cht1
.ChartType = xlLine
.SetSourceData Worksheets("Kerndaten").rng1
.Name = "Titel 1"
.HasTitle = True
.[Link] = "Eingabedaten 1"&[Var]
End with
With seriescollection([Num])
.ApplyDataLabels
.[Link] = True
End With
Set CO = [Link]("Tabelle1"). _
[Link]([Abstand des Rahmens zum linken Rand
Tabellenblatt], [Abstand nach oben], [Breite], [Höhe])
Set CH = [Link]
[Link] = xlLine
[Link] Worksheets("Tabelle1").Range("A1:C8")
Weiteres:
Sub DiagrammAendern(CH As Chart)
' Diagrammfläche
[Link] = vbCyan
' Zeichnungsfläche
[Link] = vbYellow
' Titel
[Link] = True
[Link] = "Temperatur"
' Legende
[Link] = True
With [Link]
.[Link] = vbYellow
.[Link] = vbBlue
.[Link] = xlThick
End With
' Kategorienachse
With [Link](xlCategory)
.HasTitle = True
.[Link] = "Datum"
.[Link] = "[Link]."
End With
' Werteachse
With [Link](xlValue)
.HasTitle = True
.[Link] = "Grad"
.MinimumScale = 5
.MaximumScale = 35
End With
With [Link](1)
[Link] = vbRed
.MarkerStyle = xlMarkerStyleCircle
.MarkerForegroundColor = vbRed
.MarkerBackgroundColor = vbRed
End With
' Datenpunkt
With [Link](1).Points(3)
.[Link] = vbBlue
.ApplyDataLabels xlShowValue
.MarkerStyle = xlMarkerStyleSquare
.MarkerForegroundColor = vbBlue
.MarkerBackgroundColor = vbBlue
xlMarkerStyleAutomatic -4105 Automatische Markierungen.
xlMarkerStyleCircle 8 Runde Markierungen.
xlMarkerStyleDash -4115 Lange Balken als Markierungen.
xlMarkerStyleDiamond 2 Rautenförmige Markierungen.
xlMarkerStyleDot -4118 Kurze Balken als Markierungen.
xlMarkerStyleNone -4142 Keine Markierung.
xlMarkerStylePicture -4147 Bildmarkierungen.
xlMarkerStylePlus 9 Quadratische Markierungen mit einem Pluszeichen.
xlMarkerStyleSquare 1 Quadratische Markierungen.
xlMarkerStyleStar 5 Quadratische Markierungen mit einem Sternchen.
xlMarkerStyleTriangle 3 Dreieckige Markierungen.
xlMarkerStyleX -4168 Quadratische Markierungen mit einem X.
End With
End Sub
Zeilen/Spalten tauschen:
.PlotBy = xlColumns/Rows
Dokumente einlesen:
Sub Sample()
Dim path As String
Dim openWb As Workbook
Dim openWs As Worksheet
path = "C:\Users\Me\Desktop\[Link]"
With openWs
'~~> Rest of your code here
End With
Schleifen:
Do-Schleife:
x = 0
Do
x = x + 1
Cells(x, 1).Value = x
Loop Until x > 5
Fehlerbehandlung:
Endlosschleifen verhindern:
Safety=safety+1 bei jedem Durchgang
If safety>1000 then
msgBox “Endlosschleife”
Exit Do
Fehlerlisten:
Sub oder Function nicht definiert:
[Link].[Fkt] fehlt
Objekt angewählt With [x], das es nicht oder 2x gibt
Befehle nicht ausgeführt:
Activate -> worksheets(2).Cells(x,y)
Select ->
Fehlerunterdückung:
On Error Resume Next
Fehlerbehandlung:
On Error GoTo [ErrorHandler]
[ErrorHandler]:
Select Case [Link]
Case x
MsgBox “BlaBla”
Case y
MsgBox “BlaBla”
End Select
Tasten:
F8: Einzelschritt (mit Haltepunkt markieren, Play drücken und an
Haltepunkt einzeln ausführen mit F8)
Umschalt+F8: Prozedurschritt
Ausführen bis Rücksprung (STRG+UMSCHALT+F8)
Ausführen bis Cursor (STRG+F8)
Pause: STRG+PAUSE
Funktionen:
Vorgefertigte:
Len(): Länge
Sqr(): Squarroot
Date(): heutiges Datum
Eigene:
Function()
Formen:
Formattierung:
Schriftart: Cells(i,j).[Link]=“[Schriftart]“
Fett/Kursiv: Cells (i, 1).[Link] = True
Zellenfarbe: Cells (i, 1).[Link] = [Farbe] ODER
[Link] = xlNone
If-Then-Else:
Sub Beispiel1()
If Cells(2, 1).Value < 5 Then -> hier immer in die nächste Zeile
gehen, sonst führt er nur die erste Bedinung aus!
'Wenn der Eintrag in Zelle A2 kleiner 5 ist
Cells(2, 2).Value = "Bestanden" Else
'Wenn der Eintrag in Zelle A2 nicht größer 5 ist
Cells(2, 2).Value = "Nicht bestanden"
Else
[Aktion]
End If
End Sub
End if nur am Ende einer Schachtelschleife! Beendet alle Schleifen
ODER verschachtelt:
If [Bedingung] Then
X
ElseIf [Bed1] Then
ElseIf [Bed2] Then
End If
Kommentar: ‚blabla
Kontrolle:
Debuggen in Einzelschritten F8 ODER MsgBox „Ende“ am Ende des Codes
Ausabefenster (Messagebox): MsgBox [Variable/Array/Worksheet]
Schützen: [worksheet].Protect
Kontrollkästchen:
Wert 1 oder 0: If [Link] = True Then …
Meldungen erstellen:
MsgBox “[Text]”, &[Ausgabebefehl: [Link]],
vb[buttons/Symbole + title, + vb[Symbol] “[Text links oben im
Fenster] + [helpline, [context]])
Helpline: Hilfeseiten hinterlegen (drücken F1)
Minima/Max. finden:
Sub FindeLokaleExtremwerte()
Const ZeileData1 = 2
With wksExtrem
.Range(.Rows(ZeileExtrem + 1), _
.Rows(.Cells(.[Link], PruefSpalte).End(xlUp).Row)).ClearContents
End If
End With
With wksData,mm,m,
If .Cells(ZeileData1 + 1, PruefSpalte) > dWert Then bMax = True Else bMax = False
ZeileExtrem = ZeileExtrem + 1
End If
Else
ZeileExtrem = ZeileExtrem + 1
bMax = True
End If
End If
Next
End With
End Sub
Rechnen: Range(„A1“).value=[Rechnung]
*: ^ (Leerzeichen vor und nach)
/: Teilen mit Nachkommastellen
\:Teilen ohne Nachkommastellen
Modolo: Mod x (Restausgabe nach Division durch x)
Suchen:
Dim finden as Range(“A1:Ax”)/Columns(x)
Set finden = Range("A1:Ax").Find(what:="[Begriff]")
Schließen:
VBE_Schliessen()
With [Link]
.Close
End With
End Sub
Variablen:
Festlegen erzwingen: Extras-Optionen-Variablendeklaration
erforderlich
Dim [Var] As Integer/Double/Boolean
Verschieben:
zeilen_daten = .Range("B4" & .[Link]).End(xlUp).Row
Set loesch = .Range("B4:Y50")
[Link] Shift:=xlUp
Alle ansprechen:
Dim [meinblatt] As Worksheet
Fehler:
Syntaxfehler („Fehler beim Kompilieren“)
Klammer, Punkte
Variablen/Argumente fehlen
Laufzeitfehler
Kompilierungfehler
Nicht definierte Variablen
Python
GitHub
Commit to Windows Powershell
Fertiges entpacktes Dokument
Invoke-WebRequest
'[Link] -
OutFile .\[Link]
Expand-Archive .\[Link] .\
Rename-Item .\plinqo-main .\plinqo
Remove-Item .\[Link]
Invoke-WebRequest ‘[Link]
Uncertainty/notebooks/' -OutFile .\[Link]
Expand-Archive .\[Link] .\
Rename-Item .\POMDP-main .\POMDP
Remove-Item .\[Link]
[Link]
Decision-Making-Under-Uncertainty/
tree/master/notebooks
[Link]
Science
DiaDEM
Einlesen Dateien -> Navigator (sonst Änderung ganze Datei!)
Excel: Import Wizard Excel
Darstellung Diagramme
Zoomen: +/- und Mausrad
Matlab
Befehlfenster
Eingegebenen Befehl wiederholen: Pfeil nach oben
Lookfor: suchen nach Dateien im Suchpfad
Cd work: Wechsel in das ¨ubergeordnete Verzeichnis
≫ dir % Listet alle Dateien im aktuellen Verzeichnis auf
Helpwin: Hilfe-Window
Demo: Bsp
Help [function]
Linspace: Zahlenfolge mit x Werten zwischen a und b
Disp: Display=Ausgabe
Clear [Variable]: Löschen
Save [Name]
Load [Name]: load fname x y z: L¨adt Variablen x, y und z in den Workspace
Werte:
Pi
Ans: letzte Zuweisung eines Befehls
Eps: 1e-5
Inf (infinit: unendlich) steht f¨ur 1/0
NaN (Not a Number) steht f¨ur 0/0
i, j enthalten beide die imagin¨are Einheit √−1 zur Eingabe von komplexen
Zahlen.
Arrays
Auslesen bestimmter Bereich aus Tabelle/Xlread:
startrow = 5; endrow = 100;
startcol = 11; endcol = 35;
data = xlsread('somefile', GetExcelRange(startrow, endrow,
startcol, endcol);
Functions
Unterbrechen:
if a > b
return
end
Matrizen
A=[1, 2, 3; 4, 5, 6]
≫ size(A)
≫ length(A)
Abkürzungen
A=eye(4) E =zeros([zeile],[spalte]) D =ones(([zeile],
[spalte])
A = D =
1 0 0 0 1 1 1 1
0 1 0 0 1 1 1 1
0 0 1 0 1 1 1 1
0 0 0 1 1 1 1 1
x = 1:1:10 (x=[start:step:end])
1 2 3 4 5 6 7 8 9 10
Elementweise Operationen: .[operator], z.B. A.*n
Skalarprodukt: v1'*v2
Transponiert: V‘
Grafen
2D-Kurven: plot(x,y), fplot, ezplot, subplot, stem: Balken, stairs:
Treppe
3D-Kurven: plot3(x,y,z), stem3, surf, mesh, contour
Step(sys) -> dstep(sys_d) -> Characteristics-Settling Time 2%
Ggeschlossen=feedback(Goffen,1)
Pole(Gg), Zeros(Gg) ->
K=place(A,B,[pole]);
initial(sys,[Vektor x0])
for i=8:30
% eval('parameters[j] = data(i,7)');
parameters(j).create;
parameters(j) = data(i,7);
end
Simulink
Start: Befehl „Simulink“ tippen -> Library
Arrays
Finden von Werten:
a = [7 8 8 2 5 6];
position = find(a==8)
Diagramm
2D-Plot: plot([Datenname],’LineWidth’,2);
3D-Plot: x=[x1 x2…], y=[y1 y2…], z=[z1 z2 …] -> plot3(x,y,z,’mo’ [für
Kreise])
Surface8x,y,z)
Scatter3(x,y,z)
Patch(x,y,z,‘m‘ [color magenta]) Vorstufe von mesh (1 Fläche)
[X,Y]=Meshgrid(x,y) ordnet automatisch ys x-Werte zu, auch wenn weniger x
als y-Werte -> Z=X.*Y -> Mesh(x,y,z)
X=linspace(-10,1,10), Y=linspace(-20,4,80), Z=fkt(X).*Y
Achsen: Xlabel(‘x’)
Title(‚T‘)
Import
Variablen:
Neue Data Dictionairy erstellen: Symbol unten-Link to Data Dict-
SELECT Data Dictionairy -> Simulink verschiebt alle Var des
Modells in die Dictionairy
Matlab Skript: Eingabe der Variablen
Parameter mit Terminal anlegen:
S-functions:
Lookup-functions:
Momentanaufnahmen speichern
Ergebnis:
Funktionen
function y = myfun(x1,...,xM) (1 Output)
function [y1,...,yN] = myfun(x1,...,xM) (mehrere Outputs)
Mathematische Funktionen
Variablen definieren
Terminal/Skript: var=[Wert]-Play drücken
Vektoren: v=[1 2 3], y=[1 2 3]‘ oder ; transformiert, s=[15:-3:3] Vektor 15
bis 3
mit Schrittweite -3
Matrizen: m=[1 2;3 4], size(m)=[Anzahl Zeilen, Anz Spalten],
zeros([Zeilen],[Spalten]) –Nullmatrix
Zeilen/Spalten von Matrix: m([Zeile],:), m(:,[Spalte])
Solver
Sample time
Verbindungen
Masse: Kreis, T
Information: Dreieck, V
Variablen
Passing Arguments
The most secure way to extend the scope of a function variable is to use function input and output arguments,
which allow you to pass values of variables.
For example, create two functions, update1 and update2, that share and modify an input
value. update2 can be a local function in the file update1.m, or can be a function in its own
file, update2.m.
function y1 = update1(x1)
y1 = 1 + update2(x1);
function y2 = update2(x2)
y2 = 2 * x2;
Call the update1 function from the command line and assign to variable Y in the base workspace:
X = [1,2,3];
Y = update1(X)
Y =
3 5 7
Nested Functions
A nested function has access to the workspaces of all functions in which it is nested. So, for example, a nested
function can use a variable (in this case, x) that is defined in its parent function:
function primaryFx
x = 1;
nestedFx
function nestedFx
x = x + 1;
end
end
When parent functions do not use a given variable, the variable remains local to the nested function. For
example, in this version of primaryFx, the two nested functions have their own versions of x that cannot
interact with each other.
function primaryFx
nestedFx1
nestedFx2
function nestedFx1
x = 1;
end
function nestedFx2
x = 2;
end
end
For more information, see Nested Functions.
Persistent Variables
When you declare a variable within a function as persistent, the variable retains its value from one function call
to the next. Other local variables retain their value only during the current execution of a function. Persistent
variables are equivalent to static variables in other programming languages.
Declare variables using the persistent keyword before you use them. MATLAB® initializes persistent
variables to an empty matrix, [].
For example, define a function in a file named findSum.m that initializes a sum to 0, and then adds to the
value on each iteration.
function findSum(inputvalue)
persistent SUM_X
if isempty(SUM_X)
SUM_X = 0;
end
SUM_X = SUM_X + inputvalue;
When you call the function, the value of SUM_X persists between subsequent executions.
These operations clear the persistent variables for a function:
clear all
clear functionname
Editing the function file
To prevent clearing persistent variables, lock the function file using mlock.
Global Variables
Global variables are variables that you can access from functions or from the command line. They have their
own workspace, which is separate from the base and function workspaces.
However, global variables carry notable risks. For example:
Any function can access and update a global variable. Other functions that use the variable might return
unexpected results.
If you unintentionally give a “new” global variable the same name as an existing global variable, one function
can overwrite the values expected by another. This error is difficult to diagnose.
Use global variables sparingly, if at all.
If you use global variables, declare them using the global keyword before you access them within any
particular location (function or command line). For example, create a function in a file called falling.m:
function h = falling(t)
global GRAVITY
h = 1/2*GRAVITY*t.^2;
Then, enter these commands at the prompt:
global GRAVITY
GRAVITY = 32;
y = falling((0:.1:5)');
The two global statements make the value assigned to GRAVITY at the command prompt available inside the
function. However, as a more robust alternative, redefine the function to accept the value as an input:
function h = falling(t,gravity)
h = 1/2*gravity*t.^2;
Then, enter these commands at the prompt:
GRAVITY = 32;
y = falling((0:.1:5)',GRAVITY);
function update_listBox(src,~)
vars = evalin('base','who');
[Link] = vars;
Source
Unendliche Fluide:
Kontrolle:
Überwachungsfenster mit allen Daten
notes
For n = 1 To n_rot + n_gelb + n_blau + n_gruen
With wsList
skill = .Cells(num(n) + 2, 4)
skillcode = .Cells(num(n) + 2, 3)
'c_num(1) = .Cells(num(n) + 2, 5)
r_num = .Cells(num(n) + 2, 7)
'c_pos(1) = .Cells(num(n) + 2, 6)
r_pos = .Cells(num(n) + 2, 8)
prio = .Cells(num(n) + 2, 9)
Unter cut2calc
With wsLeit
Range(.Cells(4, j), .Cells(103, j)).Value =
[Link](Range(.Cells(4, j), .Cells(103, j)), "<>0")
.Cells(58, j) = [Link](Range(.Cells(4, j), .Cells(103,
j)))
End With