grid structure in wsn..
1 view (last 30 days)
Show older comments
Susmita Das
on 17 May 2019
Commented: Walter Roberson
on 21 May 2019
how to use grid structure in wsn, I have understood that how to deploy nodes in grid structured wsn but I am unable to understand how to use 'for loop' for each cell in grid structure,how to do numbering of cells ,which node is in which cell? which cell is above the other cell. how to feed the coordinates of cells in the for loop..
0 Comments
Accepted Answer
Walter Roberson
on 17 May 2019
One_grid_info = struct('UID', -inf, 'lat', -inf, 'long', -inf, 'Energy', 10000, 'InputBuffer', [], 'OutputBuffer', []);
nrows = 17;
ncols = 12;
wsn_grid(nrows, ncols) = One_grid_info;
for row = 2:nrows - 1
row_above = row - 1;
row_below = row + 1;
for cols = 2:ncols - 1
col_left = cols - 1;
col_right = cols + 1;
neighbors = sub2ind([nrows, ncols], [row_above, col_left; row_above, col; row_above, col_right; row, col_left; row, col_right; row_below, col_left; row_below, col; row_below, col_right]);
neighbor_info = wsn_grid(neighbors);
do something
end
end
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!