annotate dealStruct.m @ 930:34d882bffae4 feature/timesteppers

Add stepping function for RK with discrete data.
author Martin Almquist <malmquist@stanford.edu>
date Mon, 03 Dec 2018 16:26:18 -0800
parents 95993ad2bd70
children b7ec26da3d77
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
874
95993ad2bd70 Add function to deal the fields of a struct to variables
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
1 function varargout = dealStruct(s, fields)
95993ad2bd70 Add function to deal the fields of a struct to variables
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
2 default_arg('fields', fieldnames(s));
95993ad2bd70 Add function to deal the fields of a struct to variables
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
3
95993ad2bd70 Add function to deal the fields of a struct to variables
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
4 assert(nargout == length(fields), 'Number of output arguements must match the number of fields');
95993ad2bd70 Add function to deal the fields of a struct to variables
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
5
95993ad2bd70 Add function to deal the fields of a struct to variables
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
6 for i = 1:length(fields)
95993ad2bd70 Add function to deal the fields of a struct to variables
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
7 varargout{i} = s.(fields{i});
95993ad2bd70 Add function to deal the fields of a struct to variables
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
8 end
95993ad2bd70 Add function to deal the fields of a struct to variables
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
9 end