Effacer les filtres
Effacer les filtres

Find mininmum value across the column

2 vues (au cours des 30 derniers jours)
Arsal15
Arsal15 le 4 Fév 2016
Commenté : Torsten le 4 Fév 2016
How I can find the minimum value across the column for each row. if I have a matrix of [51x4] and i have to compute minimum of the column value in each row.
  2 commentaires
Stephen23
Stephen23 le 4 Fév 2016
Modifié(e) : Stephen23 le 4 Fév 2016
Some tips that will help you write code and solve tasks like this all by yourself:
  • read the documentation (e.g. min explains exactly how to do this).
  • experiment, try out different ways of doing things, experiment, play with your data, and experiment. Your computer will not explode if you make a mistake.
Arsal15
Arsal15 le 4 Fév 2016
Modifié(e) : Arsal15 le 4 Fév 2016
Thanks Stephen Cobeldick for your guidance :)

Connectez-vous pour commenter.

Réponse acceptée

Torsten
Torsten le 4 Fév 2016
From the documentation:
M = min(A,[],dim) returns the smallest elements along dimension dim. For example, if A is a matrix, then min(A,[],2) is a column vector containing the minimum value of each row.
Best wishes
Torsten.
  2 commentaires
Arsal15
Arsal15 le 4 Fév 2016
Modifié(e) : Arsal15 le 4 Fév 2016
Thanks Torsten for your guidance.
But what if have to check like which values across a row are less than a threshold. like
if true
[minval, indexOfmin] = min((dist_mat,[],2)<5)
end
I tried this way like
if true
for i = length(dist_mat)
idx(i) = find (dist_mat(1,:)<5);
end
end
But for this i have to check out all index and then i have to pick the value. and giving error
In an assignment A(I) = B, the number of elements in B and I must be the same.
if true
idx(i) = find (dist_mat(1,:)<5);
end
Any simple solution to work out.
Torsten
Torsten le 4 Fév 2016
You mean
[row col] = find(dist_mat < 5)
?
Best wishes
Torsten.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur NaNs dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by