フィルターのクリア

A null assignment can have only one non-colon index.

84 ビュー (過去 30 日間)
Sandhiya Prakash
Sandhiya Prakash 2017 年 3 月 14 日
回答済み: Arpan Bhowmik 2019 年 2 月 20 日
My code is
  • for I=2:160
  • for J=2:216
  • for K=2:176
  • conventional = data(I-1:I+1, J-1:J+1, K-1:K+1);
  • mean_conventional = mean2(conventional);
  • unconventional = conventional;
  • unconventional(2,2,2) = []; %center point not included in mean
  • mean_unconventional = mean2(unconventional);
  • end
  • end
  • end
Error is A null assignment can have only one non-colon index.

回答 (1 件)

Arpan Bhowmik
Arpan Bhowmik 2019 年 2 月 20 日
Given that you have a 3D array in unconventional (based on you calling (2,2,2) the center point), that means you have a 3X3X3 array from which you are trying to delete the center point. This will leave a hole when you do a null assignment and your array will have mismatched dimensions (you cannot stitch a vector with 3 elements with one containing 2 to create a 3X2 or 2X3 aray). Try instead assigning with 0 or nan, based on what you are trying to do in mean2.

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by