\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{LSchu} \pdfinfo{ /Title (matlab.pdf) /Creator (Cheatography) /Author (LSchu) /Subject (MATLAB Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{E079CF} \definecolor{LightBackground}{HTML}{FBEEF9} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{MATLAB Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{LSchu} via \textcolor{DarkBackground}{\uline{cheatography.com/124706/cs/23867/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}LSchu \\ \uline{cheatography.com/lschu} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 10th August, 2020.\\ Updated 10th August, 2020.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{p{0.4977 cm} x{4.4793 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Hilfe}} \tn % Row 0 \SetRowColor{LightBackground} doc & Dokumentation anzeigen \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} help & Dokumentation im Befehlsfenster anzeigen \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} demo & Beispiele anzeigen \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.74655 cm} x{4.23045 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Datei Typen}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{single} & Single precision numerical data (32 bits) \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \seqsplit{double} & Double precision numerical data (64 bits) \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} char & Character array \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} \seqsplit{string} & String array \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} \seqsplit{logical} & False = 0, True = 1 \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} \seqsplit{struct} & Structure array \tn % Row Count 9 (+ 1) % Row 6 \SetRowColor{LightBackground} cell & Cell array \tn % Row Count 10 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.64241 cm} x{3.33459 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Importieren und Exportieren}} \tn % Row 0 \SetRowColor{LightBackground} load/save & Laden/Speichern von MATLAB-Variablen \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \seqsplit{dlmread/dlmwrite} & Durch "Trennzeichen"-getrennte Datei einlesen/speichern. \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} \seqsplit{readtable/writetable} & Tabelle aus Datei einlesen/speichern \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{imread/imwrite} & Bilddatei einlesen/speichern \tn % Row Count 9 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.89586 cm} x{4.08114 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Basics}} \tn % Row 0 \SetRowColor{LightBackground} clc & Befehlsfenster leeren \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} clear & Workspace leeren \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} close all & Alle figures schlie{\ss}en \tn % Row Count 4 (+ 2) % Row 3 \SetRowColor{white} whos & Zeigt Gr{\"o}{\ss}e, Bytes, Klasse und Attribute von einer Variable \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} dir & Zeigt Inhalt des aktuellen Ordners \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} ans & Zeigt letztes Ergebnis \tn % Row Count 9 (+ 1) % Row 6 \SetRowColor{LightBackground} path & Suchverzeichnis anzeigen/{\"a}ndern \tn % Row Count 10 (+ 1) % Row 7 \SetRowColor{white} \seqsplit{addpath} & Fügt Ordner tempor{\"a}r zum Pfad hinzu \tn % Row Count 12 (+ 2) % Row 8 \SetRowColor{LightBackground} which & Ordner einer Funktionen finden \tn % Row Count 13 (+ 1) % Row 9 \SetRowColor{white} size & Zeigt die Dimensionalit{\"a}t an \tn % Row Count 14 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Character Strings}} \tn % Row 0 \SetRowColor{LightBackground} a = 'Hello' & Definiert a als Character Array \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} j = 'there' & Definiert j als Character Array \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} Begrü{\ss}ung = {[}a j{]} & Fügt a und j zusammen zu 'Hello there' \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} strfind & Findet Strings in einem Character Array \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} filename = {[}'Datensatz\_' \seqsplit{num2str(subjectnumber)} '.xls'{]} & Definiert einen Dateinamen durch Strings \tn % Row Count 11 (+ 3) % Row 5 \SetRowColor{white} num2str & Macht einen numerischen Vektor zu einem character Vektor \tn % Row Count 14 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Character Strings}} \tn % Row 0 \SetRowColor{LightBackground} a = 'Hello' & Definiert a als Character Array \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} j = 'there' & Definiert j als Character Array \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} Begrü{\ss}ung = {[}a j{]} & Fügt a und j zusammen zu 'Hello there' \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} strfind & Findet Strings in einem Character Array \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} filename = {[}'Datensatz\_' \seqsplit{num2str(subjectnumber)} '.xls'{]} & Definiert einen Dateinamen durch Strings \tn % Row Count 11 (+ 3) % Row 5 \SetRowColor{white} num2str & Macht einen numerischen Vektor zu einem character Vektor \tn % Row Count 14 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.89126 cm} x{3.08574 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Variablen erstellen}} \tn % Row 0 \SetRowColor{LightBackground} x = 1 & Definiert x als 1 \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} x = nan & Definiert x als NaN ( not a number) \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} i:m & definiert einen Zeilenvektor von i bis m mit Abstand 1 \tn % Row Count 6 (+ 3) % Row 3 \SetRowColor{white} i:k:m & definiert einen Zeilenvektor von i bis m mit Abstand k \tn % Row Count 9 (+ 3) % Row 4 \SetRowColor{LightBackground} x = {[}1;2;3{]} & Definiert x als 3x1 Spaltenvektor \tn % Row Count 11 (+ 2) % Row 5 \SetRowColor{white} x = {[}1 2 3{]} & Definiert x als 1x3 Zeilenvektor \tn % Row Count 13 (+ 2) % Row 6 \SetRowColor{LightBackground} x = {[}1 2 3; 4 5 6; 7 8 9{]} & Definiert x als 3x3 Matrix \tn % Row Count 15 (+ 2) % Row 7 \SetRowColor{white} x(3) = 4 & Ver{\"a}ndert den 3. Eintrag von x zu 4 (1,2,4) \tn % Row Count 17 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.84149 cm} x{3.13551 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Rechenfunktionen}} \tn % Row 0 \SetRowColor{LightBackground} 2*3, 4+5, 3-2, 9/3, 2\textasciicircum{}2 & Multiplikation, Addition, Subtraktion, Division, Potenzieren \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} sqrt & Wurzelziehen \tn % Row Count 4 (+ 1) % Row 2 \SetRowColor{LightBackground} exp & Exponentialfunktion \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} mean & Mittelwert \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} median & Median \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} var & Varianz \tn % Row Count 8 (+ 1) % Row 6 \SetRowColor{LightBackground} std & Standardabweichung \tn % Row Count 9 (+ 1) % Row 7 \SetRowColor{white} abs & Absoluter Wert \tn % Row Count 10 (+ 1) % Row 8 \SetRowColor{LightBackground} x*3 & Multipliziert jedes Element im Vektor x mit 3 \tn % Row Count 12 (+ 2) % Row 9 \SetRowColor{white} x + 2 & Fügt jedem Element im Vektor x 2 hinzu \tn % Row Count 14 (+ 2) % Row 10 \SetRowColor{LightBackground} y + x & Elementweise Addition von y und x \tn % Row Count 16 (+ 2) % Row 11 \SetRowColor{white} y * x & Produkt von zwei Matrizen y und x \tn % Row Count 18 (+ 2) % Row 12 \SetRowColor{LightBackground} y .* x & Elementweise Produkt von Matrizen y und x \tn % Row Count 20 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.9954 cm} x{3.9816 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Indexierung - Matrizen}} \tn % Row 0 \SetRowColor{LightBackground} x(i,j) & Element von x in Zeile i und Spalte j \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} x(:,j) & Elemente von x in Spalte j \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} x(i,:) & Elemente von x in Zeile i \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} x(:,:) & Alle Elemente beider Dimensionen \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} \seqsplit{find(x==i)} & Findet Elemente in x die gleich i sind \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} x(i,j) = 1 & Ersetzt Element in Zeile i und Spalte j mit 1 \tn % Row Count 9 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.79172 cm} x{3.18528 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Statistische Tests}} \tn % Row 0 \SetRowColor{LightBackground} {[}h p{]} = ttest(data) & One Sample t-Test \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} h & 0: H0 not rejected, 1: H0 rejected \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} p & p-value \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} stats.df & Freiheitsgrade \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} stats.tstat & t-Wert \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} anova & Varianzanalyse \tn % Row Count 8 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.64241 cm} x{3.33459 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Schleifen}} \tn % Row 0 \SetRowColor{LightBackground} for & Beginn der Schleife für jedes.. \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} end & Ende der Schleife \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} for x = 1:length(i) & Für jedes Element von 1 bis i \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} while & Beginn einer logischen Schleife \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} x = true; while x & Wenn x true ist, dann \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} tic; toc & Zeiterfassung, tic = Anfang, toc = Ende \tn % Row Count 11 (+ 2) % Row 6 \SetRowColor{LightBackground} if & Wenn-Dann Schleife \tn % Row Count 12 (+ 1) % Row 7 \SetRowColor{white} elseif & Wenn nicht if Kondition, dann elseif \tn % Row Count 14 (+ 2) % Row 8 \SetRowColor{LightBackground} else & Wenn nicht elseif, dann else Kondition \tn % Row Count 16 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.14011 cm} x{2.83689 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Plots und Figures}} \tn % Row 0 \SetRowColor{LightBackground} plot(x) & Plottet x \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} plot(x,y) & Plottet x gegen y \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} errorbar & Erzeugt Fehlerbalken \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} bar & Balkendiagramm \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} hist & Histogramm \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} figure & Figure erstellen \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} hold on & H{\"a}lt die akutelle Figure "fest" \tn % Row Count 8 (+ 2) % Row 7 \SetRowColor{white} h1 = plot(x,y) & Dem Plot einen Handle zuweisen \tn % Row Count 10 (+ 2) % Row 8 \SetRowColor{LightBackground} subplot(1,2,1), subplot(1,2,2) & Layout: 1 Zeile, 2 Spalte, schreibe in Abbildung 1/Abbildung 2 \tn % Row Count 13 (+ 3) % Row 9 \SetRowColor{white} colormap & Passt Farbskala an, z.B. gray, jet oder parula \tn % Row Count 16 (+ 3) % Row 10 \SetRowColor{LightBackground} colorbar & Fügt Farbskala zur Abbildung hinzu \tn % Row Count 18 (+ 2) % Row 11 \SetRowColor{white} title('Bild') & Gibt Abbidlung einen Titel \tn % Row Count 20 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.73735 cm} x{2.23965 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{EEGLAB}} \tn % Row 0 \SetRowColor{LightBackground} addpath ('C:\textbackslash{}Users\textbackslash{}...') & Pfad für eeglab hinterlegen \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} eeglab & eeglab starten \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} eeglab redraw & Wiederherstellen von eeglab \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} pop\_selectevent(EEG,'type','target\_name') & Epoche ausw{\"a}hlen \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} \seqsplit{mean(EEG\_condition.data},3) & Average Epoche \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} find(EEG.times==400) & Bestimmtes Zeitfenster aufw{\"a}hlen \tn % Row Count 11 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}