-
Notifications
You must be signed in to change notification settings - Fork 3
/
processForestData.m~
45 lines (36 loc) · 1.4 KB
/
processForestData.m~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
function [ W_B_BAR,Y_B_BAR,B_Bar,hasTreeGrid ] = processForestData( extGridList, m, n, centerDistance )
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
numIterations = length(extGridList);
W_B_trees = cell(1, numIterations);
Y_B_trees = cell(1, numIterations);
B_trees = cell(1, numIterations);
W_B_BAR = zeros(numIterations);
Y_B_BAR = zeros(numIterations);
B_Bar = zeros(numIterations);
W_B_index = 1;
Y_B_index = 2;
B_index = 3;
hasTreeGrid = zeros(m, n);
hasTreeGridList = cell(1, numIterations);
for i = 1:numIterations
extGrid = extGridList{i};
for x = 1:m
for y = 1:n
forest_cell = extGrid(x + centerDistance, y + centerDistance);
hasTree = forest_cell.hasTree;
hasTreeGrid(x,y) = hasTree;
trees = forest_cell.trees;
if(hasTree(W_B_index))
W_B_trees{i} = [W_B_trees{i}, trees(W_B_index)];
end
if(hasTree(Y_B_index))
Y_B_trees{i} = [Y_B_trees{i}, trees(Y_B_index)];
end
if(hasTree(B_index))
B_trees{i} = [B_trees{i}, trees(B_index)];
end
end
end
end
end