필터 지우기
필터 지우기

how to find predefined values indices in a matrix?

조회 수: 1 (최근 30일)
bilgesu ak
bilgesu ak 2015년 11월 17일
답변: Omkar Shelar 2019년 9월 26일
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...

채택된 답변

Thorsten
Thorsten 2015년 11월 17일
arrayfun(@(x) ST(find(ST(:,2)==x, 1, 'last'), 3), unique(ST(:,2)))
  댓글 수: 1
bilgesu ak
bilgesu ak 2015년 11월 17일
Thank you very much, it works true;
Regards...

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Omkar Shelar
Omkar Shelar 2019년 9월 26일
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?

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by