Skip to content

Instantly share code, notes, and snippets.

@jfhbrook
Created February 10, 2010 02:15
Show Gist options
  • Save jfhbrook/299940 to your computer and use it in GitHub Desktop.
Save jfhbrook/299940 to your computer and use it in GitHub Desktop.
A subsetting function for matlab for Thermal Systems
function xn = subset(x,n)
%subset(x,n)
%sub sets array x to xn with every nth row
%example:
%> x=[1:10];
%> subset(x,2)
% ans = [2 4 6 8]
xn = x(:,1);
for i = 1:n:size(x,2)
xn = [xn x(:,i)];
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment