Changing values in matrix under certain condition
Show older comments
x = 0:50;
y = 0:20;
[X,Y] = ndgrid(x,y);
XY = [X(:), Y(:)];
R=5;
AB=[((X(:)-25).^2 + (Y(:)-10).^2).^0.5];
Displacement = permute(reshape(AB.',(compwidth+1),(compdepth+1),[]),[2 1 3])-R
How can I change the values of the matrix which meet certain condition into another specific number for further calculation?
if Displacement(:,:)<=0
%that specific value become 0
else
%values remain unchange
end
Accepted Answer
More Answers (0)
Categories
Find more on Spline Postprocessing 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!