フィルターのクリア

Index exceeds the number of array elements (10)

2 ビュー (過去 30 日間)
besaret koçak
besaret koçak 2023 年 9 月 30 日
コメント済み: besaret koçak 2023 年 9 月 30 日
var=cell(CC.NumObjects,1)
for j=1:1:n
% clear var
var(j,1)= var(double(image(CC.PixelIdxList{1,j})))
end
%
my code is like this. CC.NumObjects=10 and for example its consists of CC.PixelIdxList{1,1} = 369x1 array. Others consist of arrays like this. "CC.Pixel dxList{1,1}" values in this are pixel indices. I'm trying to measure the variance of the values corresponding to these indices in the image matrix. but it gives this error.
  6 件のコメント
Dyuman Joshi
Dyuman Joshi 2023 年 9 月 30 日
編集済み: Dyuman Joshi 2023 年 9 月 30 日
Attach the data you are working with. Use the paperclip button to do so.
Once again, why are you trying to use an empty cell array as a variable as and then over-writing it?
var{j,1} = var(double(image(CC.PixelIdxList{1,j})));
Edit - I seemed to have forgotten that var is a built-in MATLAB function :')
besaret koçak
besaret koçak 2023 年 9 月 30 日
Dyuman Joshi Thank you for your help :)

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

採用された回答

Voss
Voss 2023 年 9 月 30 日
Avoid naming your variable var, since that is the name of a function you are trying to use. Also, a cell array doesn't appear to be required; you can use a numeric vector to store the results.
var_result = zeros(n,1);
for j = 1:n
var_result(j,1) = var(double(GPR(CC.PixelIdxList{1,j})));
end
  2 件のコメント
besaret koçak
besaret koçak 2023 年 9 月 30 日
Thank you, the error has been resolved. I changed the variable name from "var" to "var_result" and it did not give an error.
Voss
Voss 2023 年 9 月 30 日
You're welcome!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by