annotate 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
rev   line source
wolffd@0 1 function [out] = strcell2matrix(in, start, finish)
wolffd@0 2 %
wolffd@0 3 % out = strcell2matrix(in,start)
wolffd@0 4 %
wolffd@0 5 % in: cell array containing string numbers (from csv2cell)
wolffd@0 6 % start: start offset of first number [row, column]
wolffd@0 7 % finish: end offset
wolffd@0 8
wolffd@0 9 % e.g. annots = strcell2matrix(annotations_final,[1 0], [0 0])
wolffd@0 10
wolffd@0 11 if nargin == 1
wolffd@0 12 start = [0 0];
wolffd@0 13 finish = [0 0];
wolffd@0 14 end
wolffd@0 15
wolffd@0 16 if nargin == 2
wolffd@0 17 finish = [0 0];
wolffd@0 18 end
wolffd@0 19
wolffd@0 20
wolffd@0 21 % ---
wolffd@0 22 % Get the data and ignore the rest
wolffd@0 23 % ---
wolffd@0 24 out = zeros(size(in) - start - finish);
wolffd@0 25
wolffd@0 26
wolffd@0 27 for i = (1 + start(1)):size(in,1) - finish(1)
wolffd@0 28 for j = (1 + start(1)):size(in,2) - finish(2)
wolffd@0 29
wolffd@0 30 out(i - start(1), j - start(2)) = str2double(in{i,j});
wolffd@0 31 end
wolffd@0 32 end