フィルターのクリア

Trends are statistically significant or not

6 ビュー (過去 30 日間)
Sophia
Sophia 2016 年 12 月 15 日
編集済み: Rik 2020 年 4 月 12 日
I have the p-values for each pixel in idanom_trend_per_winter(:,:), and i am checking which areas show statistically significant values in my dataset. So put the NaN's and values less than 0.05(the default value of alpha, i am using R2012b) as NaN, and plot the results
for ii = 1:361,
for jj = 1:361
if ((idanom_trend_per_winter(:,:) > 0.05) | (isnan(idanom_trend_per_winter(:,:))))
sgt(ii,jj) = NaN;
else
sgt(ii,jj) = idanom_trend_per_winter;
end
end
end
_ Error Subscripted assignment dimension mismatch._

採用された回答

David Barry
David Barry 2016 年 12 月 15 日
編集済み: David Barry 2016 年 12 月 15 日
Presumably instead of:
if ((idanom_trend_per_winter(:,:) > 0.05) | (isnan(idanom_trend_per_winter(:,:))))
sgt(ii,jj) = NaN;
else
sgt(ii,jj) = idanom_trend_per_winter;
end
You meant:
if ((idanom_trend_per_winter(ii,jj) > 0.05) | (isnan(idanom_trend_per_winter(ii,jj))))
sgt(ii,jj) = NaN;
else
sgt(ii,jj) = idanom_trend_per_winter(ii,jj);
end
Anyway, you can do all of this without the need for a loop. I am assuming sgt is meant to be the same size as idanom_trend_per_winter but with the substituted values, so:
sgt = idanom_trend_per_winter;
sgt(idanom_trend_per_winter < 0.05 | isnan(idanom_trend_per_winter)) = NaN;
Oh and also, you said less than 0.05 in your description but your code is checking for greater than.
  1 件のコメント
Sophia
Sophia 2016 年 12 月 16 日
Sorry my bad.. the result is the values less than 0.05, so all values above 0.05 as NaN
Thanks!

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2016 年 12 月 15 日
This: "idanom_trend_per_winter(:,:) > 0.05" is going to give you a 2-D array, not a single number like you might be expecting. Use all() or any() depending on how you want to handle that case.

カテゴリ

Help Center および File ExchangeHypothesis Tests についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by