Need help to find min(abs(dL==0)) for every column individually

7 ビュー (過去 30 日間)
md mayeen uddin
md mayeen uddin 2021 年 7 月 3 日
コメント済み: md mayeen uddin 2021 年 7 月 3 日
Hi i have two matrix and they are gradually
L1 =11953x1 double
L2 = 11953x201 double
then i have substracted from L2 to L1 columnwise
dL =L2(:,1:201)- L1;
i have to find the indices of min(abs(dL==0)) for every column and find the value of that indices [minimum absolute values which are near to zero] .and have to put them in a matrix of
X_f = 1x 201
{ i am a beginner , any help will be highly appriciateable}
  2 件のコメント
Amit Bhowmick
Amit Bhowmick 2021 年 7 月 3 日
dL =L2- L1;
[dL_min,X_f]=min(abs(dL),[],1)
md mayeen uddin
md mayeen uddin 2021 年 7 月 3 日
this also works !! thanks a lot bro

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

採用された回答

Image Analyst
Image Analyst 2021 年 7 月 3 日
Try this:
rows = 5;
columns = 8;
L1 = randi(20, rows, 1) % Create sample data.
L2 = randi(20, rows, columns)
dL = L2 - L1
for col = 1 : columns
% Find min value in this column, and it's row number (index).
[minValue(col), rowOfMinValue(col)] = min(abs(dL(:, col)));
end
% Report to command window:
rowOfMinValue
Be aware that this code finds the first min in each column only. If you expect the min to occur in more than one row, it will need some modification to give you a cell array or a larger 2-D array.
  1 件のコメント
md mayeen uddin
md mayeen uddin 2021 年 7 月 3 日
it works . thanks a lot from the core of my heart

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

その他の回答 (1 件)

Amit Bhowmick
Amit Bhowmick 2021 年 7 月 3 日
Check it out
dL =L2- L1;
[dL_min,X_f]=min(abs(dL),[],1)

カテゴリ

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