Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab 给出一个';秩值';到大光栅_Matlab_Probability_Raster_Rank - Fatal编程技术网

Matlab 给出一个';秩值';到大光栅

Matlab 给出一个';秩值';到大光栅,matlab,probability,raster,rank,Matlab,Probability,Raster,Rank,我有带概率的光栅(pforest,ppasture),我会给光栅中的值排名,这样最高的概率接收值1,第二高的值2 我试过了,但失败了。它给出了一个输出,但不是正确的输出。有人能找到真正的解决办法吗 RankforestH=zeros(592,1339); [ignore,idx]=sort(pforest); rank(idx)=1:numel(idx); RankforestH(:)=rank; RankpastureH=zeros(592,1339); [ignore,idx]=

我有带概率的光栅(pforest,ppasture),我会给光栅中的值排名,这样最高的概率接收值1,第二高的值2

我试过了,但失败了。它给出了一个输出,但不是正确的输出。有人能找到真正的解决办法吗

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;
;
这应该起作用:

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

请提供一个示例并解释为什么您当前收到的输出不是您想要的输出。我假设
pforest
ppasture
的大小是
[5921339]
,对吗?顺便说一句,打开重复的问题通常是不受欢迎的。最好通过添加代码和示例来改进原始问题。