comparison core/tools/strcell2matrix.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function [out] = strcell2matrix(in, start, finish)
2 %
3 % out = strcell2matrix(in,start)
4 %
5 % in: cell array containing string numbers (from csv2cell)
6 % start: start offset of first number [row, column]
7 % finish: end offset
8
9 % e.g. annots = strcell2matrix(annotations_final,[1 0], [0 0])
10
11 if nargin == 1
12 start = [0 0];
13 finish = [0 0];
14 end
15
16 if nargin == 2
17 finish = [0 0];
18 end
19
20
21 % ---
22 % Get the data and ignore the rest
23 % ---
24 out = zeros(size(in) - start - finish);
25
26
27 for i = (1 + start(1)):size(in,1) - finish(1)
28 for j = (1 + start(1)):size(in,2) - finish(2)
29
30 out(i - start(1), j - start(2)) = str2double(in{i,j});
31 end
32 end