Dividing a linear array into 16 or 32 equal parts is not working?

1 回表示 (過去 30 日間)
Zara Khan
Zara Khan 2019 年 3 月 3 日
コメント済み: Zara Khan 2019 年 3 月 4 日
A{k,j}=profile;
ndivisions=32;
N{k,j} = length(A{k,j});
partnum = floor(1+(0:N{k,j}-1)/N{k,j}*ndivisions);
n1{k,j} = accumarray(partnum(:),A{k,j}(:)==1);
n2{k,j}=n1{k,j}.';
n= accumarray(partnum(:),1);
o=n.';
f{k,j}=n2{k,j}./o;
profile is a linear of consequtives 0 and 1's. When diving it to 16 or 32 equal parts then I am getting this error while stroing the f value to excel sheet. I am not getting all consistent matrices.
Error using cat
Dimensions of matrices being concatenated are not consistent.
Error in cell2mat (line 83)
m{n} = cat(1,c{:,n});
Error in a_a (line 77)
D=cell2mat(f);
  4 件のコメント
Walter Roberson
Walter Roberson 2019 年 3 月 4 日
Remember that length(x) is defined as:
if any(size(x)==0)
length is 0
else
length is max(size(x))
end
It is not rows and it is not columns: it is whichever dimension is largest.
Zara Khan
Zara Khan 2019 年 3 月 4 日
How can I implement this code? here for each image I am getting 8 different profile which are varying in length and all are one dimensional array of consequtives o's and 1's. I am repeating thsi process over 1000 images. when diving each profile into 32 equal parts then I am not getting consistent matrices.

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

回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by