This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function varargout = unpack(in) | |
% python-like unpacking of arrays | |
% simulink compatability, delete if not using in simulink | |
condition = coder.ignoreConst(nargout <= length(in)); # simulink compatible version (should work in matlab as well) | |
% condition = nargout <= length(in); # matlab code | |
assert(condition, 'To many value to unpack!') | |
if length(in) > nargout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function s = packs(varargin) | |
% pack struct | |
% if no arguments are passed in ... whole workspace gets packed | |
% else only arguments get parsed. | |
% | |
% Example: | |
% | |
% a = 4; | |
% b = 3; | |
% c = 15; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [] = unpacks(s) | |
% unpack struct | |
% unpacks 1 dimension into workspace that calls this function | |
assert(isstruct(s) && length(s) == 1, 'Only supply a struct!'); | |
fieldnames = fields(s); | |
for i=1:length(fieldnames) | |
name = fieldnames{i}; | |
value = s.(name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [] = startup() | |
% Set up Plots | |
get(groot,'Factory'); | |
set(groot,'DefaultLineLineWidth', 1.2); | |
set(groot,'defaultfigurecolor',[1 1 1]); | |
set(groot,'defaultAxesFontSize',11); | |
set(groot,'defaulttextinterpreter','latex'); | |
set(groot,'defaultLegendInterpreter','latex'); | |
set(groot,'defaultAxesTickLabelInterpreter','latex'); |