Could anyone please explain this matlab code...?
Show older comments
function g = NeumannBoundCond(f)
[nrow,ncol] = size(f);
g = f;
g([1 nrow],[1 ncol]) = g([3 nrow-2],[3 ncol-2]);
g([1 nrow],2:end-1) = g([3 nrow-2],2:end-1);
g(2:end-1,[1 ncol]) = g(2:end-1,[3 ncol-2]);
1 Comment
dpb
on 20 Mar 2014
Format code so it's legible...
Accepted Answer
More Answers (1)
Walter Roberson
on 20 Mar 2014
In general, the form
array([A B], C)
refers to selecting the elements of the array in which the row is A or B, and the column is any of the values given by C. So (A,C(1)), (A,C(2)), (A,C(3))... (B,C(1)), (B,C(2)), ...
With A, B, C, D all scalar, array([A B], [C D]) would designate four locations, (A,C), (A,D), (B,C), (B,D)
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!