Mercurial > repos > public > sbplib
comparison cell2vector.m @ 14:a66aefd5e6ac
Added functions for converting vectors to and from cell format.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 22 Sep 2015 09:46:20 +0200 |
parents | |
children | e2fefb6f0746 |
comparison
equal
deleted
inserted
replaced
13:b18d3d201a71 | 14:a66aefd5e6ac |
---|---|
1 % cell2vector accepts a column cell array of column vectors and returns a columnvector | |
2 % with the input concatenated. It also returns the number of elements in each vector. | |
3 % cv -- column cell array with column vectors | |
4 % v -- vector of the concatenated vectors | |
5 % n -- number of elements in each vector before concatenation. Can be used with vector2cell(). | |
6 function [v, n] = cell2vector(cv) | |
7 v = []; | |
8 n = zeros(length(cv),1); | |
9 | |
10 for i = 1:length(cv) | |
11 n(i) = length(cv{i}); | |
12 v = [v; cv{i}]; | |
13 end | |
14 end |