Effacer les filtres
Effacer les filtres

how to find predefined values indices in a matrix?

1 vue (au cours des 30 derniers jours)
bilgesu ak
bilgesu ak le 17 Nov 2015
Hi;
I have a matrix that first column shows the tasks, second column is the station numbers that tasks assigned and third one is the total station times as:
ST= [ 1 1 6
5 1 10
4 2 5
2 2 7
3 3 9
7 4 6]
I want to have the each station's last total station time as it should be =[10 7 9 6].
How can I write it's code?
Thanks in advance; Regards...

Réponse acceptée

Thorsten
Thorsten le 17 Nov 2015
arrayfun(@(x) ST(find(ST(:,2)==x, 1, 'last'), 3), unique(ST(:,2)))
  1 commentaire
bilgesu ak
bilgesu ak le 17 Nov 2015
Thank you very much, it works true;
Regards...

Connectez-vous pour commenter.

Plus de réponses (1)

Omkar Shelar
Omkar Shelar le 26 Sep 2019
Hi,
I have formed a matrix 2x2 m matrix
m=[1 2 3;4 5 6]
i carry out certain operations in matlab. after some operations i want to see the m matrix again. Which command shall i use?

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by