matlab - give a 'rank value' to large rasters -


i have rasters probabilities (pforest,ppasture) , give rank values within raster highest probability receives value 1, 2nd highest value 2, ....

i tried failed.it gives output not right output. real solution?

rankforesth=zeros(592,1339);   [ignore,idx]=sort(pforest); rank(idx)=1:numel(idx); rankforesth(:)=rank;   rankpastureh=zeros(592,1339);   [ignore,idx]=sort(ppasture); rank(idx)=1:numel(idx3); rankpastureh(:)=rank; ; 

this should work:

rankforesth = zeros(size(pforest)); [~,idx] = sort(pforest, 'descend'); rankforesth(idx) = 1:numel(idx); 

Comments