find values in a matrix
이전 댓글 표시
Hi,
I have a matrix A (attached):
A=[0 0 0 0 0 0 0 0 0 0 1933724 260957;
341255 0 0 0 0 0 0 0 0 0 12973 0;
23261 0 0 0 0 0 0 153505 0 420315 0 15372;
0 0 0 0 0 0 0 0 0 5535878 0 0;
0 0 0 0 0 0 0 0 0 16516 0 316637]
the rows of the matrix reppresent trajectories, every cell of the matrix contains the location id of trajectories and the colums indicated the time of study of this trajectories. The time is 24 hours so the rows are divide in interval of 2 hours: total 12 intervals that corrispond to the columns. I hope it's clear. Now I want to find in A, if a location rows is present in a particular interval. Eg. I want to know if 12973 is present in interval 1: if it's present I want to indicate it in another matrix in the same position with the value one, if it's not present I want to extend the interval of research until I can found the value.
Can you help me?
채택된 답변
추가 답변 (1개)
Meghan
2016년 9월 7일
1 개 추천
You should be able to use the ismember function for that.
카테고리
도움말 센터 및 File Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!