How can I find midpoint in a structure of rows?
2 ビュー (過去 30 日間)
古いコメントを表示
Hello everyone,
I am trying to find every midpoint value between the min and max points that is in a row within a sturcture of rows.
Lumbar.Lift.AllMin = min(lumbar_lift,[],2);
Lumbar.Lift.AllMax = max(lumbar_lift,[],2);
This has worked with me so far. However, when I use the code below, it gives me weird values that are definetely not between the these values:
Lumbar.Lift.Allmid = min(abs(lumbar_lift-((Lumbar.Lift.AllMax + Lumbar.Lift.AllMin))/2),[],2);
your help is appirciated
0 件のコメント
採用された回答
Chunru
2021 年 6 月 26 日
a = randn(3, 10);
[nrows, ncols] = size(a);
[amin, imin] = min(a, [], 2)
[amax, imax] = max(a, [], 2)
amed = median(a, 2)
% mid points
for i=1:nrows
[~, imid] = min(abs(a(i, :)-(amin(i) + amax(i))/2)); % Get the index that coloset to the "mid point"
amid(i, 1) = a(i, imid);
end
amid
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!