0
我的圖像陣列:C_filled = 256x256x3270更新用新值的結構體在for循環中
我想要做的是計算每個圖像的質心,並存儲對應於每個「片」每個質心和/或圖像成陣列。然而,當我嘗試更新的陣列,像一個普通的數組,我得到這個錯誤:
"Undefined operator '+' for input arguments of type 'struct'."
我有以下代碼:
for i=1:3270;
cen(i) = regionprops(C_filled(:,:,i),'centroid');
centroids = cat(1, cen.Centroid);% convert the cen struct into a regular array.
cen(i+1) = cen(i) + 1; <- this is the problem line
end
如何更新陣列存儲每個新心?
在此先感謝。
謝謝!完美地工作,有沒有辦法將一個1-3270的額外列添加到質心,例如[x,y,z],因爲這對應於所討論的對象的長度。 – Idrawthings
是的,請看我編輯 –
嗯,所有的索引值似乎是2,我也在尋找3x3270類型的數組,類似於3D座標系統。基本上我會有[x,y]質心座標,添加1:3270的額外矩陣。 – Idrawthings