Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to remove one value from cell array, when looking for maximums in graph

1 回表示 (過去 30 日間)
Edvardas Vysniauskas
Edvardas Vysniauskas 2016 年 5 月 17 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hey,
I was running decorrelation stretch on images, trying to find the most red spots in image ( for now this method gave best results). When analyzing the pixel values, i was trying to identify maximum pixel value of one color channel and i ran into a problem: when checking for maximum values, there were two maximums that had the same Y value and got stored into one cell array's cell. Is there a way how to avoid this issue? Thanks in advance
  1 件のコメント
Guillaume
Guillaume 2016 年 5 月 17 日
"Is there a way how to avoid this issue?" Most likely. However, without seeing the code that creates the issue it's difficult to help you.

回答 (1 件)

Rangan M K
Rangan M K 2016 年 5 月 17 日
編集済み: Rangan M K 2016 年 5 月 17 日
Just before assigning it to the cell check the length of the cell if its 1 then continue with assignment else just assign the first element to the cell.
if length(a)==1
a(i)=Yourval(k)
else
a(i)=Yourval(k,1)
end

Community Treasure Hunt

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

Start Hunting!

Translated by